Should constants be introduced to Python?

Ned Batchelder ned at nedbatchelder.com
Thu Nov 16 13:24:04 EST 2017


On 11/16/17 1:16 AM, Saeed Baig wrote:
> Hey guys I am thinking of perhaps writing a PEP to introduce constants to Python. Something along the lines of Swift’s “let” syntax (e.g. “let pi = 3.14”).
>
> Since I’m sort of new to this, I just wanted to ask:
> - Has a PEP for this already been written? If so, where can I find the link/info to it?
> - 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 don't know if a PEP like this has been attempted before.  They are all 
in one place (https://github.com/python/peps/), so it's not hard to find 
out.

But talking about it here first will be a good way to flesh out your 
ideas, hear the most likely objections, and so forth.

Start by telling us: Why should Python have constants?  Be specific: 
what current problems would it solve?

--Ned.



More information about the Python-list mailing list