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- >>>plementation? >> >><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) > http://www.python.org/peps/pep-0351.html > > 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? -- http://mail.python.org/mailman/listinfo/python-list