Leandro Lucarella wrote: > !? It's true that in Python all are references, but there are inmutable > objects in Python, like int, float, strings and tuples. From a practical > POV it exactly the same as value types, if you do:
Immutable reference types are still reference types, and follow the same rules as other reference types. You just can't modify them. The assignment operator *always* rebinds a reference, regardless of the mutability or immutability of any objects involved. The one exception is that operators like '+=' will create a new object when applied to immutable types, but modify existing objects when applied to mutable objects. And, yes, this bothers me in Python. A lot. But that's still not half as bad as D, where something simple like 'a = b; a.x = 5;' can have two completely different meanings depending on whether 'a' is a reference type or a value type. -- Rainer Deyke - [email protected]
