12.07.18 02:25, Gregory P. Smith пише:
(c) adding a .freeze() method to sets which would raise an exception if the set's refcount were > 1 and would mutate the type of the set object into a frozenset object in place.  refcount assertions are bad, not all VMs need refcounts.  The concept of a method that can mutate the type of the underlying object in place is... unpythonic.  even though technically possible to implement within CPython.

It is just an implementation detail that set and frozenset use the same internal representation, and just have different types. But it is possible to implement more efficient representation for frozensets. I have some ideas and could implement them if Raymond allows.

_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to