Guido van Rossum wrote: > Well, I don't recall what CLPython is, but I believe it is broken and > that code should work -- there are (or used to be) examples of using > exec to populate classes in the standard library so while it may look > dodgy it really is exected to work... I think this behaviour (modifying locals() at class scope) was actually implicitly blessed in PEP 3115, even though that PEP doesn't explicitly state locals() in a class body is required to grant access to the namespace returned by __prepare__(). Perhaps the time is right for the locals() documentation to be more explicit regarding when modifying its contents will affect the current namespace? - yes at module scope (effectively the same as globals()) - yes at class scope - maybe (but typically not) at function scope Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://www.boredomandlaziness.org
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