[EMAIL PROTECTED] a écrit : > Yes, I know that "constant" A will also be modified as the b[0] points > to A. Obviously the [] should be marked as immutable, as A is declared > to be constant thus immutable. If somebody tries to modify this > immutable object an error would occur. > > When I further thought about this problem with constant objects (and > values), I run into this scenario: What if I want to use a constant > object/value as a template (or predefined value/class) for a variable: > > constant A = ['1'] # let's declare A as immutable constant value/object > b = A # let's assign b some default value > b.append('2') # and let's play with b, but I wouldn't want to change A
def A(): return ['1'] b = A() b.append('2') -- http://mail.python.org/mailman/listinfo/python-list