On Fri, Mar 2, 2018 at 5:39 PM, Ethan Furman firstname.lastname@example.org wrote:
Seems like it would far easier and (IMHO) more useful to scale the proposal back from a statement scope to simple expression assignment, and the variable is whatever scope it would have been if assigned to outside the expression (default being local, but non-local or global if already declared as such).
No grammatical grit on anyone's monitor, no confusion about which variable is being accessed, and no confusion about the lifetime of that variable (okay, no /extra/ confusion ;) .
Maybe somebody could explain why a statement-local limited scope variable is better than an ordinary well-understood local-scope variable? Particularly why it's better enough to justify more line-noise in the syntax. I'm willing to be convinced (not happy to, just willing ;) .
Sounds like what you're proposing could be done with the exact syntax that I'm using, and just remove subscopes from the discussion. (It'd still need parenthesization, I believe, to prevent syntactic ambiguities.) As a competing proposal, it's plausible; basically, it gives Python a way to assign to any name at any time. I'm honestly not sure which variant would see more backlash :)
That's worthy of a mention in the alternates, at any rate.