On Tue, May 25, 2021 at 9:55 PM Shreyan Avigyan
<pythonshreya...@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
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/SJH7NFG7QJ6IAK27W3CO36ZAESPA37YR/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to