Hi, On Wed, Jun 11, 2008 at 10:44:17PM -0400, Scott Dial wrote: > The only reason the test used locals() was > because it was the only way to insert a non-string key into the class > namespace. This discussion is mistakenly focused on locals(). There is a direct way to have arbitrary keys in the dict of a type: >>> MyClass = type('MyClass', (Base,), {42: 64}) >>> MyClass.__dict__[42] 64 There is, however, no way to modify or add non-string keys in the type after its creation. So the question is whether the type() constructor is allowed to fail with a TypeError when the initial dict contains non-string keys (this is PyPy's current behavior). A bientot, Armin.
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