oops, forgot to include the list.
i really hate lists that don't have the the list as the default reply setting :-(
(Yes, I know that goes against the conventional wisdom)
On Wed, May 26, 2021 at 9:14 AM Shreyan Avigyan firstname.lastname@example.org
Well. How can I go beyond why constant was invented in the first place?
But constant was invented for other, far more static languages. And many in this thread have said that even then it often needs to be worked around.
The main reason constant was invented was to provide an additional
support to programmers so that they don't make a program unstable.
The same could be said for static typing.
And Python’s solution to that is type annotations and type checkers. Which supports Final.
In short, yes, the concept of constant is useful, but it is not a good fit for Python.
When you spoke of “like a literal” that brought to mind something else: a C preprocccesor like pre-complier time substitution. Which might have some use, but it would only work within a single module, so not very useful.
-- Christopher Barker, PhD (Chris)
Python Language Consulting
- Scientific Software Development
- Desktop GUI and Web Development
- wxPython, numpy, scipy, Cython