> Le 8 juil. 2020 à 19:15, David Mertz <me...@gnosis.cx> a écrit : > > On Wed, Jul 8, 2020, 1:00 PM Paul Sokolovsky > Right. So, if someone would like to add something to this thread, I'd humbly > suggest to concentrate on the lack of, and need for, of const-ness in the > Python language core (in comparison to other languages or not), and usecases > it enables, and not on criteria for "popularness". > > I admit I do not really understand what gain dynamic languages get from > constants. I pretty uniformly use a common convention of ALLCAPS for constant > names (knowing they are not really const in Python or bash, where I tend to > use them). >
This is what I see most, and sometimes beginner misunderstand constness with not re-binded names e.g.: LOGGER = logging.getLogger(__name__) > I think that clarifies intent in an important way. But checking it feels like > a job for linters, or perhaps for a future mypy or other type checker. > Mypy has Final (https://mypy.readthedocs.io/en/stable/final_attrs.html#final-names): from typing_extensions import Final RATE: Final = 3000 class Base: DEFAULT_ID: Final = 0 RATE = 300 # Error: can't assign to final attribute Base.DEFAULT_ID = 1 # Error: can't override a final attribute > I can easily imagine that a VM might gain speed with that information, but > that alone does not feel like enough reason for a language change. > _______________________________________________ > Python-Dev mailing list -- python-dev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/HZD7TNMZHO2URXVCJLPCJLOF4Q6L7GJW/ > Code of Conduct: http://python.org/psf/codeofconduct/ _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/AGDYR6WD4GXA3ZIEQFOMX27PBIX7FZ3V/ Code of Conduct: http://python.org/psf/codeofconduct/