Re: Could frozendict or frozenmap be of some use for PEP 683 (Immortal objects)?

2022-03-10 Thread Marco Sulla
On Wed, 9 Mar 2022 at 23:28, Martin Di Paola wrote: > Think in the immutable strings (str). What would happen with a program > that does heavy parsing? I imagine that it will generate thousands of > little strings. If those are immortal, the program will fill its memory > very quickly as the GC wi

Re: Could frozendict or frozenmap be of some use for PEP 683 (Immortal objects)?

2022-03-09 Thread Martin Di Paola
I perhaps didn't understand the PEP completely but I think that the goal of marking some objects as immortal is to remove the refcount from they. For immutable objects that would make them truly immutable. However I don't think that the immortality could be applied to any immutable object by def

Could frozendict or frozenmap be of some use for PEP 683 (Immortal objects)?

2022-03-09 Thread Marco Sulla
As title. dict can't be an immortal object, but hashable frozendict and frozenmap can. I think this can increase their usefulness. Another advantage: frozen dataclass will be really immutable if they could use a frozen(dict|map) instead of a dict as __dict__ -- https://mail.python.org/mailman/lis