[Python-ideas] Re: PEP-603: Adding a frozenmap type to collections

2019-09-12 Thread Andrew Svetlov
Please bring your questions to https://discuss.python.org/t/pep-603-adding-a-frozenmap-type-to-collections/2318 to have the single discussion site. On Fri, Sep 13, 2019 at 5:06 AM Andrew Barnert wrote: > > On Sep 12, 2019, at 11:15, Andrew Svetlov wrote: > > > > As Yuri said the proposed impleme

[Python-ideas] Re: PEP-603: Adding a frozenmap type to collections

2019-09-12 Thread Andrew Barnert via Python-ideas
On Sep 12, 2019, at 11:15, Andrew Svetlov wrote: > > As Yuri said the proposed implementation is 15x times faster than pyrsistent. > hamt library doesn't exist on PyPI. I probably didn’t remember the names of all of the relevant PyPI projects off the top of my head. But shouldn’t that be includ

[Python-ideas] Re: PEP-603: Adding a frozenmap type to collections

2019-09-12 Thread Anders Hovmöller
> On 13 Sep 2019, at 00:38, Greg Ewing wrote: > > Yury Selivanov wrote: >> A *persistent data structure* is defined as a data structure that >> preserves the previous version of the data when the data is modified. >> Such data structures are effectively *immutable*, as operations on >> them do

[Python-ideas] Re: PEP-603: Adding a frozenmap type to collections

2019-09-12 Thread Greg Ewing
Yury Selivanov wrote: A *persistent data structure* is defined as a data structure that preserves the previous version of the data when the data is modified. Such data structures are effectively *immutable*, as operations on them do not update the structure in-place, but instead always yield a ne

[Python-ideas] Re: PEP-603: Adding a frozenmap type to collections

2019-09-12 Thread Andrew Svetlov
As Yuri said the proposed implementation is 15x times faster than pyrsistent. hamt library doesn't exist on PyPI. immutables library is a code written by Yuri, it uses hamt datastructure internally. Basically, the proposed frozenmap is a port of immutables (with the class renaming). In turn, immuta

[Python-ideas] Re: PEP-603: Adding a frozenmap type to collections

2019-09-12 Thread Andrew Barnert via Python-ideas
On Sep 12, 2019, at 04:46, Yury Selivanov wrote: > > Hi! > > I've just published a PEP to add a frozenmap type to Python; it should > be online shortly. > > Read it here: > https://discuss.python.org/t/pep-603-adding-a-frozenmap-type-to-collections/2318 How does this compare in performance, f

[Python-ideas] Re: PEP-603: Adding a frozenmap type to collections

2019-09-12 Thread Yury Selivanov
BTW, I forget to mention, but please post replies here: https://discuss.python.org/t/pep-603-adding-a-frozenmap-type-to-collections/2318 I'm checking this mailing list on a far less regular schedule. Besides, splitting the discussion between two different mediums isn't a good idea anyways. Yury

[Python-ideas] Re: PEP-603: Adding a frozenmap type to collections

2019-09-12 Thread Yury Selivanov
I think pyrsistent uses the same data structure -- HAMT. Regardless of that, using it is a nonstarter because (a) we already use the bulk of frozenmap implementation to power the contextvars module; (b) pyrsistent is 15x slower, see https://gist.github.com/1st1/be5a1c10aceb0775d0406e879cf87344#gist

[Python-ideas] Re: PEP-603: Adding a frozenmap type to collections

2019-09-12 Thread Anders Hovmöller
> On 12 Sep 2019, at 13:46, Yury Selivanov wrote: > > Hi! > > I've just published a PEP to add a frozenmap type to Python; it should > be online shortly. > > Read it here: > https://discuss.python.org/t/pep-603-adding-a-frozenmap-type-to-collections/2318 My two cents: the motivation for "f

[Python-ideas] Re: PEP-603: Adding a frozenmap type to collections

2019-09-12 Thread Paul Moore
On Thu, 12 Sep 2019 at 14:58, Neil Girdhar wrote: > > I'll let other people comment on this wrt Python (even though I think it > looks cool and useful to me). Out of curiosity, why does frozenmap not have > the same runtime and ordering guarantees as dict? Presumably because the implementation

[Python-ideas] Re: PEP-603: Adding a frozenmap type to collections

2019-09-12 Thread Neil Girdhar
I'll let other people comment on this wrt Python (even though I think it looks cool and useful to me). Out of curiosity, why does frozenmap not have the same runtime and ordering guarantees as dict? On Thursday, September 12, 2019 at 7:47:25 AM UTC-4, Yury Selivanov wrote: > > Hi! > > I've jus

[Python-ideas] PEP-603: Adding a frozenmap type to collections

2019-09-12 Thread Yury Selivanov
Hi! I've just published a PEP to add a frozenmap type to Python; it should be online shortly. Read it here: https://discuss.python.org/t/pep-603-adding-a-frozenmap-type-to-collections/2318 Here's an excerpt from the Abstract: A *persistent data structure* is defined as a data structure that pr