python-dev summary, July 16-31

Peter Hansen peter at engcorp.com
Wed Aug 8 02:21:13 CEST 2001


François Pinard wrote:
> 
> [Just van Rossum]
> 
> > But there has always been a nice symmetry between "if x in y" and
> > "for x in y",
> 
> About that one, it always saddened me a little bit that I may not write:
> 
>         if x in 1, 2, 3:
>             pass
> 
> while I can write:
> 
>         for x in 1, 2, 3:
>             pass

I would never have thought to write either of these.  On the other
hand, if I did write things the second way, I would _expect_ that
the first one would work as well. 

> In the first, I write the parentheses so it gets accepted, but I would
> prefer not using them.  It breaks some of the symmetry, in my opinion :-).

It's not so much that symmetry is missing -- it just doesn't follow
the "rule of least surprise", does it?

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com



More information about the Python-list mailing list