Hi,

from http://docs.python.org/ref/objects.htm

"""Types affect almost all aspects of object behavior. Even the importance of object identity is affected in some sense: for immutable types, operations that compute new values may actually return a reference to any existing object with the same type and value, while for mutable objects this is not allowed. E.g., after "a = 1; b = 1", a and b may or may not refer to the same object with the value one, depending on the implementation, but after "c = []; d = []", c and d are guaranteed to refer to two different, unique, newly created empty lists. (Note that "c = d = []" assigns the same object to both c and d.)"""


I would like to know how i can guarantee that a new immutable object is infact a new object.

Example:

>>> a = 1
>>> b = 1
>>> a is b
True

is what i get. i want a and b to be two different object.

Thanks in advance

Premnath Sah T. H.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to