We've already had all of this since long before typing.py existed.

ALLCAPS means "this value should only be set once and not changed."

_underscore means "this is not part of public API, and it may change in next version.

__double_under means "this is SERIOUSLY not something you should muck with, it's likely to break stuff if you do."

Python should never become a B&D language like Java. If a user violates the contracts provided by code they utilize, that's on them, not on the language.

On Tue, May 25, 2021, 11:28 AM Stestagg <stestagg@gmail.com> wrote:


On Tue, May 25, 2021 at 4:02 PM Ethan Furman <ethan@stoneleaf.us> wrote:
On 5/25/21 5:23 AM, Chris Angelico wrote:
 > On Tue, May 25, 2021 at 9:55 PM Shreyan Avigyan wrote:

 >> The proposed syntax is as follows,
 >>
 >> constant x = 10
 >> constant y = ["List"]
 >> constant z: str = "Hi"
 >
 > https://docs.pytcorehon.org/3/library/typing.html#typing.Final
 >
 > Already exists :)

Optional typing != core Python.


I mean, it's part of the standard library, so we could argue on personal definitions of 'core Python', but it would be more useful to work out exactly what aspects of typing.Final are lacking for you.

Why would this constant annotation need to be more strongly enforced than type checks?  What actual benefit would this provide?

Steve


--
~Ethan~
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@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/NZUWNBFWI5ESOW6CVMQA7CZTRNFVJJLA/
Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@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/2G2NFUN453R4DGVGOYYAZJQYBGQ2OC2A/
Code of Conduct: http://python.org/psf/codeofconduct/