On Thu, 19 Aug 2010 01:24:11 pm Nitin Das wrote: > Hello, > > Can somebody help me how to make immutable objects in python. I > have seen overriding the __new__, __setattr__ methods.. but not > comfortable with how to use them to make the object immutable. > > thanks in advance > --nitin
I have found this useful: http://northernplanets.blogspot.com/2007/01/immutable-instances-in-python.html Keep in mind that the only way to make *truly* immutable objects in Python is to write them in C. Immutability of pure-Python objects can be broken if you try hard enough. Immutability is by cooperation, not enforced. -- Steven D'Aprano _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor