On 12/03/2016 23:57, BartC wrote:
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).


It is 2016. Programmer time, and hence money, are far more important than runtime speed in the vast majority of cases. There are plenty of working recipes for switch in Python. I'll leave you to quote a few as you are such an expert in the Python programming language.

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to