[Python-ideas] while with as [was: if with as]

Georg Brandl g.brandl at gmx.net
Wed Mar 7 17:20:18 CET 2007


Jim Jewett schrieb:

>> As for this particular case, it is only useful in a very restricted set
>> of expressions and I was only able to find a handful of cases in stdlib
>> where I could drop in a "if x as y".
> 
> I have wanted it, though not nearly so often as I have wanted it for
> the "while" loop.
> 
> The workarounds with break/continue or changing to a for-loop always bother me.
> 
> That said, I'm still not sure it would be worth the cost, because
> people might start trying to write
> 
>     while (1,2,3)
> 
> and expecting an implicit iteration; the confusion to beginners
> *might* outweigh the benefits.

Hm, why would anyone write that because of the new "as" syntax?

Georg




More information about the Python-ideas mailing list