Thoughts about Python

Rainer Deyke rainerd at eldwood.com
Tue Feb 24 23:37:34 EST 2004


Sean Ross wrote:
> """
> obj.freeze -> obj
>
> Prevents further modifications to obj. A TypeError will be raised if
> modification is attempted. There is no way to unfreeze a frozen
> object. See also Object#frozen? .
> """

An interesting idea.  This would also allow other mutable types such as
dictionaries to be used as dictionary keys.  I'm not sure if I like it, but
I am sure that I am not happy with the current list/tuple situation.

An alternate approach would be for the dictionary to lock the key objects
when they are inserted and unlock them when they are removed.  Another would
be for dictionaries to keep a private copy of their keys.


-- 
Rainer Deyke - rainerd at eldwood.com - http://eldwood.com





More information about the Python-list mailing list