[Python-ideas] Wild idea about mutability

Random832 random832 at fastmail.com
Mon Jun 6 09:34:24 EDT 2016


On Mon, Jun 6, 2016, at 06:44, Sven R. Kunze wrote:
> Thinking this further, __init__ would be the only function to change the 
> state of an immutable object. Once created, it will never change. 
> Immutable also implies hashability IMHO.

You're continuing to fail to address the fact that some aspects of this
proposal implicitly claim that immutable objects shall not hold
references to mutable objects (a tuple containing a reference to a list
is not hashable*, does this mean tuples are not immutable?) while other
claims (OP's claim that an "immutable list" could substitute for a
tuple) imply that they can.

> Moreover, immutable object 
> would not be allowed to query data from global/external variables as 
> those can change and would change the observable state of the object 
> without the object noticing.

How are you gonna stop them?

*Java seems to work fine with mutable lists being hashable and trusting
users to responsibly manage the life cycles of dictionaries using them
as keys, but this is an argument that we don't really need to start up
again here and now.


More information about the Python-ideas mailing list