Yes the same consideration applies to any new feature. I think that Python's reticence to add new features has been a strength. And I do think the benefit here is absolutely negligible.
It's not that I don't like constants - but there's a bunch of things that go great together, like constants, functional programming, and static type analysis, and none of those are in python. There are plenty of languages that have that; and nothing that prevents you from creating a desugaring compiler for an extended version of python. Indeed, I think that a lot of features like annotations would be better in an extension project. Constants (from a code quality perspective) really manifest their benefits in statically preventing errors. A linter can warn about assignment to ALL_CAPS, ClassNames, and built-in names. If you're following appropriate conventions (and your linter isn't a pure peephole linter) you can identify those errors. On Fri, Nov 17, 2017 at 4:47 PM, Saeed Baig <saeedbaig...@icloud.com> wrote: > Well I think that depends on how one defines simplicity. Which seems > simpler, this: > > # Treat as constants > c = 299792458 # Speed of light > e = 2.71828 # Euler’s constant > > or this: > let c = 299792458 # Speed of light > let e = 2.71828 # Euler’s constant > > The latter involves less typing, and is hardly more difficult to > understand. > > I can see where you’re coming from; it does arguably add complexity. But > one could argue that ANY new feature to the language (list comprehension, > lambdas, type hints, etc) will add complexity to the language just by > virtue of being an extra thing to learn. One has to consider the benefit VS > cost of a new feature by comparing “How useful is it” to “How complex is > it”. > > And forgive me for my ignorance on this topic, but how can linting give > the benefits of constants? > > On 18 Nov 2017, at 02:14, Marcin Tustin <marcin.tus...@gmail.com> wrote: > > I'm against this because Python's strength is its simplicity. This doesn't > actually simplify anything, but it does add a new language feature to > understand. > > All the benefits of this can be achieved with linting. > > On Thu, Nov 16, 2017 at 1:16 AM, Saeed Baig <saeedbaig...@icloud.com> > 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. >> -- >> https://mail.python.org/mailman/listinfo/python-list >> > > > > -- > Marcin Tustin > Tel: +1 917 553 3974 <(917)%20553-3974> > > > -- Marcin Tustin Tel: +1 917 553 3974 -- https://mail.python.org/mailman/listinfo/python-list