[Python-ideas] Should Python have user-defined constants?

Paul Moore p.f.moore at gmail.com
Tue Nov 21 04:47:16 EST 2017

-1. I don't see how this would improve any programs I've written or
seen. Tools like mypy or linters might benefit from a feature to track
constants and ensure they don't get changed, but I don't think it's
needed as a language feature. Seriously, has anyone ever written
"math.pi = 5" and been surprised that their code broke? Or even
modified an application constant like BUFFER_LIMIT? Do you have any
evidence that this would avoid bugs in real-world code?


PS Please fix your font - your posts are coming through with a huge
font size for some reason, which makes them extremely difficult to

On 21 November 2017 at 06:33, Saeed Baig <saeedbaig616 at icloud.com> wrote:
> Hey guys I am thinking of perhaps writing a PEP to introduce user-defined
> constants to Python. Something along the lines of Swift’s “let” syntax (e.g.
> “let pi = 3.14”).
> Do you guys think it would be a good idea? Why or why not? Do you think
> there’s a better way to do it? I’d like to know what others think about this
> idea before making any formal submission (I’ve already posted this same
> question on python-list, but I just wanted to gauge opinion here too).
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/

More information about the Python-ideas mailing list