On Sun, 26 Jul 2009 11:24:48 -0700, John Nagle wrote: > An interesting issue is Python objects, which are always mutable. > A "dict" of Python objects is allowed, but doesn't consider the contents > of the objects, just their identity (address). Only built-in types are > immutable; one cannot create a class of immutable objects.
Yes you can, for some definition of "can": http://northernplanets.blogspot.com/2007/01/immutable-instances-in-python.html Admittedly pure Python objects are only "cooperatively immutable". The immutability relies on the caller not going out of its way to break the instance, so you can mutate it if you work at it. One could, I suppose, try putting in complicated tricks to prevent that, but anything written in Python can ultimately be modified in Python. -- Steven -- http://mail.python.org/mailman/listinfo/python-list