Gerhard Haering gerhard.haering at
Sun Aug 25 21:02:23 CEST 2002

* David Garamond <davegaramond at> [2002-08-26 01:49 +0700]:
> does python support some sort of constant variables?

Short answer: no.

Long answer: All-uppercase identifiers are considered constant, i. e.  "don't
change me", just as names with one or two leading underscores are considered

For class instances, there are properties (in Python 2.2 and later, earlier you
have to override __getattr__ and __setattr__), that can be used to create
read-only attributes.

mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    OpenPGP public key id 86AB43C0
public key fingerprint: DEC1 1D02 5743 1159 CD20  A4B6 7B22 6575 86AB 43C0
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))

More information about the Python-list mailing list