On Tue, May 25, 2021 at 06:09:29PM -0000, Shreyan Avigyan wrote:
I actually suggest a different kind of Constant in Python not the classical const we see in Java or C/C++.
Constants doesn't mean we can't reassign the name to a different value.
So... constants aren't constant? They're variables?
Constants behave like literals. They are sort of literals actually.
In what way are they like literals? How do literals behave?
We reference a value by a name. Variable is just a reference to a value and can change to provide reference to another value.
Right. A variable is a name that references a value.
Constants on the other hand are name for a value.
Right. Constants are a name that references a value.
So constant is a name we can alternatively use for a value.
Indeed. The only difference between a constant and a variable is that constants cannot be rebound to a new value, but variables can. But you've said that you want constants to be capable of being rebound to a new value. So your constants are identical to variables.
So 10 is same as constant while 10 is same as the value dereferenced by variable.
I don't understand what you are trying to say here. -- Steve