python3: 'where' keyword

Carl Banks invalidemail at
Sat Jan 8 18:55:49 EST 2005

Peter Hansen wrote:
> Andrey Tatarinov wrote:
> >  >>> print words[3], words[5] where:
> >  >>>     words = input.split()
> >
> > - defining variables in "where" block would restrict their
visibility to
> > one expression
> Then your example above doesn't work...  print takes a
> sequence of expressions, not a tuple as you seem to think.

You misunderstand.  There "where" is not part of the expression but the
statement.  The above example would be a modified print statement, a
print...where statement, if you will.  Under this suggestion, there
would be modified versions of various simple statements.

This wouldn't be a problem parsing, of course, because "where" would be
a keyword.


More information about the Python-list mailing list