[Python-Dev] Issue 14417: consequences of new dict runtime error

Etienne Robillard animelovin at gmail.com
Sat Mar 31 13:43:28 CEST 2012


> The frozendict builtin type was rejected, but we are going to add
> types.MappingProxyType: see issue #14386.
> types.MappingProxyType(mydict.copy()) is very close to the frozendict
> builtin type.
>
> Victor

Thanks, Victor. :)

Will this mean the new dict subclass for CPython will not expose 
dictproxy to favorize a new types.MappingProxyType type to emulate 
immutable-like types ? What could be then consequences for code still 
expecting a non-mutable dict() type ? Therefore I guess this ticket 
provides more than just speculating points to reconsider such aliased 
types in cpython.

I also found this article quite useful: 
http://www.cs.toronto.edu/~tijmen/programming/immutableDictionaries.html

Yet I might miss how this "new dict" type could potentially induce a 
RuntimeError unless in python 3.3 a new dict proxy alias is introduced 
to perform invariant operations in non thread-safe code.

Regards,
Etienne


More information about the Python-Dev mailing list