This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients Arfrever, daniel.urban, ezio.melotti, flox, jcea, ncoghlan
Date 2013-03-14.07:24:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I hadn't noticed that type.__new__ copied the contents (it surprises me that it does both that *and* restricts the input type to a true dict instance).

The "Extending a class" example should still work as shown, since the magic of that happens while the body of ExtendedExample is running.

For the order preserving case, it turns out CPython already keeps a copy of the original namespace around as cls.__locals__, but this is currently undocumented (as far as I can tell anyway).

If we elevate that to documented behaviour, then __init_class__ implementations can reference both the original object, as well as the snapshot underlying the class object.

Given that, it is probably also better to revert the namespace keyword to accepting an instance rather than a factory function, since the copy operation after execution of the class body is automatic.
Date User Action Args
2013-03-14 07:24:32ncoghlansetrecipients: + ncoghlan, jcea, ezio.melotti, Arfrever, flox, daniel.urban
2013-03-14 07:24:32ncoghlansetmessageid: <>
2013-03-14 07:24:32ncoghlanlinkissue17044 messages
2013-03-14 07:24:32ncoghlancreate