Victor Stinner wrote: >>> * frozendict values must be immutable, as dict keys >> Why? That may be useful, but an immutable dict whose values >> might mutate is also useful; by forcing that choice, it starts >> to feel too specialized for a builtin. > > Hum, I realized that calling hash(my_frozendict) on a frozendict > instance is enough to check if a frozendict only contains immutable > objects. And it is also possible to check manually that values are > immutable *before* creating the frozendict. > > I also prefer to not check for immutability because it does simplify > the code :-) > > $ diffstat frozendict-3.patch > Include/dictobject.h | 9 + > Lib/collections/abc.py | 1 > Lib/test/test_dict.py | 59 +++++++++++ > Objects/dictobject.c | 256 ++++++++++++++++++++++++++++++++++++++++++------- > Objects/object.c | 3 > Python/bltinmodule.c | 1 > 6 files changed, 295 insertions(+), 34 deletions(-) > > The patch is quite small to add a new builtin type. That's because > most of the code is shared with the builtin dict type. (But the patch > doesn't include the documentation, it didn't write it yet.) > Could you create an issue for this on the tracker, maybe write a PEP. I don't think sending patches to this mailing list is the way to do this. Would you mind taking a look at how your code interacts with PEP 412. Cheers, Mark.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4