python3: 'where' keyword

Carl Banks invalidemail at
Sat Jan 8 19:25:50 EST 2005

Paul Rubin wrote:
> "Carl Banks" <invalidemail at> writes:
> > You misunderstand.

BTW, Peter, I guess I should have said "I misunderstand, but it can be
legal if you consider it part of the statements", since it appears the
author did intend it to be part of an expression.

> > There "where" is not part of the expression but the
> > statement.  The above example would be a modified print statement,
> > print...where statement, if you will.  Under this suggestion, there
> > would be modified versions of various simple statements.
> You mean I can't say
>    # compute sqrt(2) + sqrt(3)
>    x = (sqrt(a) where:
>          a = 2.) \
>        + sqrt (a) where:
>            a = 3.
> Hmmm.

What would be the advantage of that over this?

. x = sqrt(a) + sqrt(b) where:
.     a = 2.0
.     b = 3.0

Where would making "where" part of an expression rather than part of
the statement help?  Can you think of a place?  ("That it makes Python
more like LISP" is not a good enough answer for me, BTW.  But feel free
to try. :)


More information about the Python-list mailing list