On Sun, 2011-03-06 at 07:58 +0000, Steven D'Aprano wrote: > On Sat, 05 Mar 2011 20:33:49 -0800, Westley Martínez wrote: > > > On Sat, 2011-03-05 at 18:37 -0800, John Nagle wrote: > >> It's worth having some syntax for constants. I'd suggest > >> using "let": > > +1 on syntax for constants. -0 for "let". I'd prefer something more > explicit, like "const". > > > I'm against constants, for the purpose of "programmers should be smart > > enough to not set a variable to another value that should be static", > > Most programmers are smart enough not to rebind names which should be > constant. The problem is, how do you know which names should be constant? > > A naming convention like ALL_CAPITALS helps, but not everybody sticks to > the convention. Also, if constants are enforced by the compiler, that > opens the door for many optimizations that currently Python can't do even > in principle. > > > > > but if Python were to have constants I think it would be better to use > > something more descriptive than 'let'. Also, because the defined > > constant is static, I think it would be better to use 'is' instead of > > '='. Example: > > No, we're talking about assignment, not a comparison operator. The `is` > operator is equivalent to `==`, equals, not assignment. > > > -- > Steven I'm confused. Can someone tell me if we're talking about constant as in 'fixed in memory' or as in 'you can't reassign' or both?
-- http://mail.python.org/mailman/listinfo/python-list