Thomas Wouters wrote: > > ... > > He decided to go to David Beazly's python introduction, and he was suprised > at how you can do 'None = 4'. And when I explained it's harmless (because > it's local, not global) he was suprised it didn't generate a warning. And, > well, why doesn't it generate a warning ? Only with an, uhm, '-w' option or > so, of course, or perhaps add it to the '-t' option. It would be also a > compile-time-check. It might require a seperate lookup table (haven't looked > at it at all, yet) that duplicates the 'builtin' namespace, but I'd think > it's worth it. A few thoughts: * None, map and other such long-term, ancient built-ins should not be directly overridable. I don't think we need a warning mode. Just outlaw it. We can do this with a semantic check in the compiler. * Those with a good reason to shadow them would do it by assignment to the module's dict or __builtins__. The "feature" would still be there if you need it, but it would be syntactically distinct. Or maybe we need to disallow it entirely to allow optimizers to attack this important special case. * Python badly needs a warning infrastructure. If I had time, that would be my first PEP. I'd rather the former tightening up was not hostage to a warning infrastructure that nobody gets around to implementing, though. -- Paul Prescod - Not encumbered by corporate consensus It's difficult to extract sense from strings, but they're the only communication coin we can count on. - http://www.cs.yale.edu/~perlis-alan/quotes.html
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4