On 29 May 2001, David Beazley said: > Therefore, I'm wondering if it would make any sense to make the > iterator variables used inside of a list comprehension private in some > manner--either through name mangling or some other technique? For > example: Two ideas occur to me: * make the list comprehension a new scoping level, which of course is doable now that we have sensible scoping semantics. Presumably the usual warning message about shadowing variables from an outer scope will apply; you'll still have the bug in your code, but at least Python will tell you about it * don't make list comprehensions a separate scope, but add a little trickery so that something *like* the "shadowing variable from an outer scope" message is emitted Haven't really thought about backwards compatibility issues... Greg
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