
On 02/28/2018 12:16 PM, Alex Walters wrote:
For what its worth, I'm +1 on it.
I actually like that it would allow:
while (something() as var): something_else(var)
...without being a bug magnet. The bug magnet isn't the assignment of a name in the condition of a while loop, it's the fact that assignment is a simple typo away from comparison. This is not a simple typo away from comparison (the operands are a different order, too).
I also like the above, but as a more general assignment-in-expression, not as a statement-local -- the difference being that there would be no auto-deletion of the variable, no confusion about when it goes away, no visual name collisions (aside from we have already), etc., etc. Maybe I'll write yet-another-competing-PEP. ;) -- ~Ethan~