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. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com