Mike Meyer <[EMAIL PROTECTED]> writes: > There isn't a standard serialize method in Python, so I don't know how > you want to define it.
Well, consider pickle, for example. > I can think of perfectly reasonable definitions > of serialize where obj.serialize() won't always return the same string > on an immutable object, even if you don't allow adding attributes. Fair enough. How's this: a = ImmutableObject() b = deepcopy(a) assert a == b # a and b start out equal .... do stuff .... # since a and b are immutable, they should still be equal # no matter what has happened above assert a == b If you've added attributes to a but not to b, they should compare unequal, breaking immutability. -- http://mail.python.org/mailman/listinfo/python-list