Possible constant assignment operators ":=" and "::=" for Python

Piet van Oostrum piet at cs.uu.nl
Fri May 12 06:48:12 EDT 2006


>>>>> tsaar2003 at yahoo.com (T) wrote:

>T> As you can see, the "constant" A can be modified this easily. But if
>T> there were an intuitive mechanism to declare a symbol to be immutable,
>T> then there won't be this problem.

Mutability is not a property of symbols but of values. So it doesn't make
sense to declare an identifier to be immutable. And mutability is tied to
the object's type, not to individual instances.

What you want can only be obtained if Python would have an immutable
variant for each type or would add an immutable attribute to each object.
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list