3 ms·
I strongly disagree. In Python, you can find exactly where every identifier comes from (unless you use `from foo import *`, but that's frowned upon) and it make
by rcfox 7y ago
I strongly disagree. In Python, you can find exactly where every identifier comes from (unless you use `from foo import *`, but that's frowned upon) and it makes it extremely easy to navigate code and documentation.
I've had to look at some C# web service code recently, and the amount of magic it relied on made it impossible for me to find what I was looking for, even using grep.
- zrobotics 7y agoBut isn't something like from tk import * essentially equivalent to my C++ example? They're bad practices in both languages. Thankfully python examples seem to be better in this regard, since I don't recall seeing wildcard imports in any of the tutorials or references I've used.
- rcfox 7y agoYes, and it does make code more difficult to read. I've looked at a fair amount of Python code, and it is very rare to see import * in the wild. On the other hand, import * is nice to have in a repl.
- ajross 7y agoAnd I strongly repeat that well-understood and commonly-used APIs benefit (strongly, heh) from concision and idiom. Seriously, when was the last time a C programmer needed to figure out where identifiers like "strlen" or "fread" come from? The problem you posit need not exist for big chunks of commonly used APIs, and the inability of modern programmers (trained, it seems, on C# web service code) to see that is frustrating.
- Too 7y ago> Seriously, when was the last time a C programmer needed to figure out where identifiers like "strlen" or "fread" come from? http://www.suodenjoki.dk/us/archive/2010/min-max.htm http://www.suodenjoki.dk/us/archive/2010/min-max.htm