Thanks for the reminder Victor.
For a read-only *dict*, I proposed PEP 416 "Add a frozendict builtin
> type" in 2012. It was rejected.
> https://peps.python.org/pep-0416/
Note that that was ten years ago -- so maybe worth revisiting.
The outcome of this PEP was the addition of the types.Mapping
PEP 603 adds a frozenmap type to collections, implemented as HAMT.
For a read-only *dict*, I proposed PEP 416 "Add a frozendict builtin
type" in 2012. It was rejected.
https://peps.python.org/pep-0416/
The outcome of this PEP was the addition of the types.MappingProxy
type (previously, it already
On Sun, 3 Apr 2022, 12:58 pm Steven D'Aprano, wrote:
>
> I haven't considered pickling, or deep-copying. I don't think there is
> any way to get access to the underlying dict and modify it, except
> perhaps via ctypes, so I think it is as immutable as it is possible to
> get from Python code. Fee
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
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 i
>
> 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 dr
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
implementa
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
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 find a better design, we can just
> switch to it, while 'immutabl
Hi, Steve. Thanks for your detailed explanation. Indeed I already saw the
API discussion in PEP 603. It's much easier to make the decision in a
third-party library. I think we will be fine with the immutables library.
On Fri, Apr 1, 2022 at 7:05 PM Steve Dower wrote:
> On 4/1/2022 11:48 AM, zhan
On 4/1/2022 11:48 AM, zhang kai wrote:
Thanks Victor and Pablo. I will check the discussion of PEP 603. It's a
little weird to use the immutables library when it's code in already in
CPython but I'm glad it's anĀ option.
The main difference is that 'immutables' offers you a stable/versioned
in
Thanks Victor and Pablo. I will check the discussion of PEP 603. It's a
little weird to use the immutables library when it's code in already in
CPython but I'm glad it's an option.
Kai
On Fri, Apr 1, 2022 at 6:14 PM Pablo Galindo Salgado
wrote:
> You may want to check PEP 603, which more or les
You may want to check PEP 603, which more or less proposes this (the author
of the pep is the author of the HAMT code)
check https://peps.python.org/pep-0603/
Alternatively, there is already a pypi package with this code:
https://pypi.org/project/immutables/
Regards from cloudy London,
Pablo
O
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://
14 matches
Mail list logo