[Python-ideas] Immutable dictionaries

David Mertz mertz at gnosis.cx
Wed Nov 29 12:42:09 EST 2017


https://www.python.org/dev/peps/pep-0416/

Also: https://pypi.python.org/pypi/frozendict

On Wed, Nov 29, 2017 at 9:30 AM, Asen Bozhilov <asen.bozhilov at gmail.com>
wrote:

> This is my first post here. I have strong experience with JavaScript and
> I'm lucky that I could move forward to Python.
> What I miss in Python are immutable dictionaries. They are especially
> useful for configurations and call functions which expect dictionary as
> argument.  In my opinion they would let a place for underlying
> optimizations.
>
> I'd like to propose also literaling syntax for immutable dictionaries.
>
> immutable_dict = (
>     'key1' : 'value1',
>     'key2' : 'value2'
> )
>
> This syntax is not ambiguous with expression statements and tuple
> literals, but it requires a bit lookahed during the parsing.
>
> I would appreciate your opinions on the topic. Most interesting for me is
> why they are not already part of the language?
>
> Kind regards,
> Asen Bozhilov
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
>


-- 
Keeping medicines from the bloodstreams of the sick; food
from the bellies of the hungry; books from the hands of the
uneducated; technology from the underdeveloped; and putting
advocates of freedom in prisons.  Intellectual property is
to the 21st century what the slave trade was to the 16th.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20171129/eb1ca378/attachment-0001.html>


More information about the Python-ideas mailing list