Attitude about new keywords

Michele Simionato mis6 at pitt.edu
Mon Feb 10 12:16:55 EST 2003


Ian Bicking <ianb at colorstudy.com> wrote in message news:<mailman.1044868955.24487.python-list at python.org>...
> On Sun, 2003-02-09 at 08:03, Michele Simionato wrote:
> > I am more
> > in the favor of
> > 
> > x when condition else x
> > 
> > since "when" could be not made a reserved keyword, just as "as"  in the
> > import statement.
> 
> I would hate to see "as" become a model for new keywords.  I think "as"
> is okay because it can only show up in a very specific place -- in a
> certain part of the import statement, and the import statements usually
> go right at the top of the file (especially ones that use "as").
> 
> But other pseudo-keywords would cause much more difficulty in reading. 
> If I see "when" I couldn't use that as an anchor for the expression --
> that is, I couldn't read forwards or backwards from that keyword to
> understand the rest of the expression.  Instead I'd be forced to find a
> different anchor that preceded it and go forward to find the context of
> the "when", and thus whether it is a keyword or a variable.
> 

I guess this is subjective, I am not bothered at all by the reverse
order in list comprehensions

[x for x in range(10) if x!=5]

which I find very readable. Nevertheless, I see from the PEP thread that
many don't like that. Mah! misteries of the human nature...

> Especially because when is a lame variable name, I don't think it's
> worth such a convolution to save it.  But I think I'd feel that way for
> almost all keywords.

It seems that you don't like the ternary operator then, since you are 
saying not only that "when" is lame (why?) but that you would dislike any 
other keyword. Or may be you are in favor of  (if cond: x else: y) ?

I am becoming quite pessimistic that we will ever reach a consensus...

cheers,

         Michele




More information about the Python-list mailing list