Hi,

In 2019, Yury Selivanov, who added HAMT and contextvars to Python,
wrote PEP 603 "Adding a frozenmap type to collections":
https://peps.python.org/pep-0603/

Sadly, the PEP was stuck in discussions:

* 
https://discuss.python.org/t/pep-603-adding-a-frozenmap-type-to-collections/2318
* https://discuss.python.org/t/pep-603-frozenmap-vs-my-frozendict/2473

I don't think that differences between dict and frozenmap was a
blocker issue. In fact, if I recall correctly, there was no blocker
issue.

Anyway, Yury is also maintaining the "immutables" 3rd party module
which implements frozenmap:
https://pypi.org/project/immutables/

Victor

On Fri, Apr 1, 2022 at 11:37 AM zhang kai <kylerzhan...@gmail.com> wrote:
>
> Hi,
>
> HAMT is a very useful immutable mapping type. Currently CPython use it 
> internally to implement contextvar. Considering immutable data structure is 
> very useful I hope we can make it available to python script(maybe via 
> collections module).
>
> Immutable data structures are fundamental parts of our project. Currently we 
> use a full-featured python immutable data library called pyrsistent. 
> Pyrsistent is very powerful, however the map type in it is implemented in 
> python script not in C. It becomes slow when the data set is relatively large.
>
> On the other hand, CPython now already has an immutable mapping type in it. I 
> think maybe it’s a good idea to make it public? Many projects can benefit 
> from it I believe.
>
> Here is a talk given by the author of javascript immutable-js library explain 
> why immutable data structures are powerful: 
> https://www.youtube.com/watch?v=I7IdS-PbEgI
>
> Pyristent: https://github.com/tobgu/pyrsistent
>
> What do you think?
>
> Cheers,
> Kai
> _______________________________________________
> Python-Dev mailing list -- python-dev@python.org
> To unsubscribe send an email to python-dev-le...@python.org
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at 
> https://mail.python.org/archives/list/python-dev@python.org/message/2WYPX44WBFS2ZMZFNMDFMRPROB7G34JQ/
> Code of Conduct: http://python.org/psf/codeofconduct/



-- 
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/PQ42TTASV3ZOBJUTDHARTVTPY5EPIW57/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to