while expression feature proposal

Dan Loewenherz dloewenherz at gmail.com
Wed Oct 24 16:40:57 EDT 2012


Hi all,

This is my first post to this group--I'm not subscribed, so please CC
me in responses.

So I'm sure a lot of you have run into the following pattern. I use it
all the time and it always has felt a bit awkward due to the duplicate
variable assignment.

VAR = EXPR
while VAR:
    BLOCK
    VAR = EXPR

I'm curious what the possibility of adding the following to Python as
syntactic sugar:

while EXPR as VAR:
    BLOCK

Apologies if that has been proposed before. I searched the archives
and couldn't find any mention of it.

Best,
Dan



More information about the Python-list mailing list