On Wed, Oct 24, 2012 at 3:54 PM, Tim Chase
<[email protected]> wrote:
> It may be idiomatic, but that doesn't stop it from being pretty
> ugly. I must say I really like the parity of Dan's
>
> while EXPR as VAR:
> BLOCK
>
> proposal with the "with" statement. It also doesn't fall prey to
> the "mistaken-assignment vs. intentional-assignment" found in most
> C-like languages. I could see a pretty reasonable PEP coming from this.
Often though the while test is not a simple boolean test of VAR. For example:
j = int(random() * n)
while j in selected:
j = int(random() * n)
It also doesn't flow quite as naturally. "with x as y" is
grammatically correct English. "while x as y" is not, and I wonder
how easily it might be confused for "while x is y", which is valid
Python and means something completely different.
--
http://mail.python.org/mailman/listinfo/python-list