On 12/03/2016 22:10, Marko Rauhamaa wrote:
Chris Angelico <ros...@gmail.com>:
I completely agree with you that the keyword should mean "write-once"
or "never rebind".
That would be possible. I'm afraid that would result in people
sprinkling these "constant" keywords everywhere to make the program
supposedly run faster. -- Something like that has happened with the
"final" keyword in some Java houses.
I use 'const' everywhere in other languages, most often in the form of
sophisticated sets of enums. A single project might have 1000 or even
2000. (Example that defines a set of byte-codes:
http://pastebin.com/q1UwjKmK)
How does Python manage without them? Is it really necessary to declare
hundreds of individual variables and assign a value to each? (And risk
someone assigning a new value to them.)
That they might lead to more efficient code is secondary, but definitely
a bonus (essential though when used in a switch statement).
--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list