[Python-ideas] Should Python have user-defined constants?
sf at fermigier.com
Tue Nov 21 03:26:17 EST 2017
When programming in JS, I find myself aggressively aiming for as little
'let' and as much 'const' as reasonably possible, since reasoning about
constants is much easier than about variables. In this context, 'const' is
used as a marker, a runtime checker, and, with proper tooling (IDE or
linter), a coding-time reminder to differentiate between these two
I'm not +1 on introducing this idea to Python yet, but not -1 either - this
deserves some discussion, if this has not been discussed already.
On Tue, Nov 21, 2017 at 9:13 AM, Steven D'Aprano <steve at pearwood.info>
> On Tue, Nov 21, 2017 at 02:38:45AM -0500, Joseph Jevnik wrote:
> > How is that different from "pi = 3.14"?
> pi = 3.14
> pi = 5
> # prints 5
> let pi = 3.14
> pi = 5
> # raises an exception
> Python-ideas mailing list
> Python-ideas at python.org
> Code of Conduct: http://python.org/psf/codeofconduct/
Stefane Fermigier - http://fermigier.com/ - http://twitter.com/sfermigier -
Founder & CEO, Abilian - Enterprise Social Software -
Chairman, Free&OSS Group / Systematic Cluster -
Co-Chairman, National Council for Free & Open Source Software (CNLL) -
Founder & Organiser, PyData Paris - http://pydata.fr/
“You never change things by ﬁghting the existing reality. To change
something, build a new model that makes the existing model obsolete.” — R.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas