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

Chris Rebert pyideas at rebertia.com
Fri Feb 24 01:56:02 CET 2012


On Thu, Feb 23, 2012 at 4:27 PM, Victor Stinner
<victor.stinner at haypocalc.com> wrote:
>> And you can't use __slots__ because...?
<snip>
> components.unknown=10 raises an error, but not components.red=2.
> __slots__ denies to add new attributes, but not to modify existing
> attributes.
>
> The idea of using a frozendict is to deny the modification of an
> attribute value after the creation of the object. I don't see how to
> use __slots__ to implement such constraints.

Right, stupid question; didn't think that one all the way through.

- Chris



More information about the Python-ideas mailing list