General question about Python design goals
roccomoretti at hotpop.com
Thu Dec 1 19:35:18 CET 2005
Fredrik Lundh wrote:
> Rocco Moretti wrote:
>>>>I'm sure Antoon wouldn't object if lists were to be allowed as
>>>>dictionary keys, which would eliminate the multiple castings for
>>>>that situation. I wouldn't, either.
>>>so what algorithm do you suggest for the new dictionary im-
>><devil's_advocate> One option is to create a new "frozen list" type, a`
>>la frozen sets.
> doesn't frozenset make a copy?
As does the current "cast as tuple" technique. (I'm certainly not
advocating it, but ...) Certain implementations of "frozen list" could
possibly do the list->frozenlist conversion without a copy. (e.g. by
flipping an "immutable" bit)
> This PEP describes a simple protocol for requesting a frozen,
> immutable copy of a mutable object.
Perhaps Barry has been borrowing Guido's time machine?
More information about the Python-list