[Python-ideas] Wild idea about mutability
Sven R. Kunze
srkunze at mail.de
Mon Jun 6 16:32:24 EDT 2016
On 06.06.2016 15:34, Random832 wrote:
> (a tuple containing a reference to a list
> is not hashable*, does this mean tuples are not immutable?)
Your question in brackets is actually the most important question here.
I would say it depends on who one defines it but I don't see a
contradiction to have both variants of tuples in the same languages.
Whatever fits your needs more in a certain situation.
>> 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?
With a hammer? I don't know how you want me to answer that. It's an
implementation detail to me as other languages can handle it properly.
There is a way of stopping them by preventing all ways of manipulating
state variables of an object. What those ways are is more a topic for
long-served devs of CPython 4 or 5 ;-)
Sven
More information about the Python-ideas
mailing list