[Python-Dev] Re: Make HAMT available to python script

2022-04-02 Thread Steven D'Aprano
On Sat, Apr 02, 2022 at 09:28:55AM -0700, Christopher Barker wrote: > Anyway, it would be nice for someone to take up the mantle of getting an > immutable Mapping into the stdlib. Here is a "FrozenMapping" class that could be added to collections. I have tested it ~~extensively~~ for nearly two

[Python-Dev] Re: Make HAMT available to python script

2022-04-02 Thread Christopher Barker
On Sat, Apr 2, 2022 at 6:30 AM Steve Dower wrote: > >> + 1 from me -- just the other day I was wishing it was there. > > > > There would presumably need to be be a C API as well, and that would > > probably expose more of the implementation unless handled carefully. > > Without seeing an actual

[Python-Dev] Re: Make HAMT available to python script

2022-04-02 Thread zhang kai
> > All of that kind of adds up to make it a distraction that's likely worse > than a dict subclass with __setitem__ overridden (if that's the > behaviour you want). It's a fantastic data structure for when you need > it, but it's one that deserves to be researched and understood before > simply

[Python-Dev] Re: Make HAMT available to python script

2022-04-02 Thread Steve Dower
On 02Apr2022 0925, Paul Moore wrote: On Sat, 2 Apr 2022 at 02:30, Christopher Barker wrote: On Fri, Apr 1, 2022 at 4:06 AM Steve Dower wrote: The main difference is that 'immutables' offers you a stable/versioned interface to use it, while the one that's in CPython is an internal

[Python-Dev] Re: Make HAMT available to python script

2022-04-02 Thread Paul Moore
On Sat, 2 Apr 2022 at 02:30, Christopher Barker wrote: > > On Fri, Apr 1, 2022 at 4:06 AM Steve Dower wrote: >> >> The main difference is that 'immutables' offers you a stable/versioned >> interface to use it, while the one that's in CPython is an internal >> implementation detail. If one day we