[Python-ideas] Support other dict types for type.__dict__
Victor Stinner
victor.stinner at haypocalc.com
Fri Feb 24 00:34:49 CET 2012
Hi,
I'm trying to create read-only objects using a "frozendict" class.
frozendict is a read-only dict. I would like to use frozendict for the
class dict using a metaclass, but type.__new__() expects a dict and
creates a copy of the input dict.
I would be nice to support custom dict type: OrderedDict and
frozendict for example. It looks possible to patch CPython to
implement this feature, but first I would like first to know your
opinion about this idea :-)
Victor
More information about the Python-ideas
mailing list