On Tue, May 25, 2021 at 9:55 PM Shreyan Avigyan pythonshreyan09@gmail.com wrote:
I posted my previous idea regarding this on the mailing list. This idea is a little different. This idea suggests introducing constant name bindings. This is similar to const pointer in C/C++. Once a name has been assigned to a data we can change the data (if mutable) but we cannot change the name to point to a different data. The only way the data the constant points can get deallocated is if it goes out of scope, the program exits or the constant is manually `del` by the user. The proposed syntax is as follows,
constant x = 10 constant y = ["List"] constant z: str = "Hi"
https://docs.python.org/3/library/typing.html#typing.Final
Already exists :)
ChrisA