On 1/23/17 1:27 PM, Gerald Britton wrote: > > > On Jan 23, 2017 1:12 PM, "Britton, Gerald" <gerald.brit...@td.com > <mailto:gerald.brit...@td.com>> wrote: > > > > > You're mixing up value immutability with name immutability. The name > > isn't immutable, but: > > > Er...No. I'm not confused at all, unless you define immutability in a > new way.. you said that the "value bound to long_name is immutable." > It's not. Your example below proves it. > > An immutable object is one whose state cannot be modified once set. > That's not happening here. The state of the object bound to > long_name, which is a pointer to an instance of you class, changes > with each line.
In Python, names refer to values. Values can be immutable. Ints, strings, and tuples are examples of immutable values. They cannot be mutated. In Python, names cannot be immutable. It is always possible to make an existing name refer to a new value. --Ned.
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/