New statement proposal for Python
Magnus Lie Hetland
mlh at idi.ntnu.no
Thu Jun 14 19:54:59 CEST 2001
"David LeBlanc" <whisper at oz.nospamnet> wrote in message
news:9gao5s$8ft$7 at 220.127.116.11...
> One thing that bugs me about Python is that there's no really good way to
> have named constants so that magic numbers can be avoided. Assigning to a
> variable that (should) never changes is not the same (i.e. the "should
> never" part).
> My proposal:
> alias httpport : 80
Hm. Unconventional use of the colon, isn't it? (For Python, I mean.)
Anyway - what is it you want with this? Efficiency, on enforcing
the non-changing state of the variables?
I can't really see the need for this myself - but if something like it is
ever implemented, I really hope we won't have similar solutions to those
used to simulate private variables. I mean...
>>> _const_httpport = 80
>>> _const_httpport = 90
Traceback (most recent call last):
File "<stdin>", line 1, in ?
ConstError: constant '_const_httpport' is already defined
> Dave LeBlanc
Magnus Lie Hetland http://www.hetland.org
"Reality is that which, when you stop believing in
it, doesn't go away." -- Philip K. Dick
More information about the Python-list