[Python-ideas] Support other dict types for type.__dict__

Simon Sapin simon.sapin at kozea.fr
Fri Feb 24 10:22:32 CET 2012

Le 24/02/2012 06:33, David Townshend a écrit :
> Can't this also be done using metaclasses?


Are you thinking of __prepare__? I did to but I read the details of this:


The class body can be executed "in" any mapping. Then I’m not sure but 
it looks like type.__new__ only takes a real dict. You have to do 
something in your overridden __new__ to eg. keep the OrderedDict’s order.

Simon Sapin

More information about the Python-ideas mailing list