[Python-ideas] If branch merging

Ron Adam ron3200 at gmail.com
Fri Jun 12 01:23:03 CEST 2015


On 06/11/2015 03:10 PM, Ethan Furman wrote:
> On 06/11/2015 03:56 AM, Chris Angelico wrote:
>
>> while input("Spam? ") as spam:
>>      print(globals())
>>      break
>>
>> Spam? yes
>> {... 'spam.0x7f2080260228': 'yes'...}
>
> Having names not leak from listcomps and genexps is a good thing.

In a way this makes sense because you can think of them as a type of 
function literal.



> Having names not leak from if/else or while is confusing and irritating:
> there is no scope there, and at least 'while' should be similar to 'for'
> which also does a name binding and does /not/ unset it at the end.

Having a group of statement share a set of values is fairly easy to think 
about.  Having them share some values at some times, and not others at 
other times is not so easy to think about.

I also get the feeling the solution is more complex than the problem. 
Ummm... to clarify that.  The inconvenience of not having the solution to 
the apparent problem, is less of a problem than the possible problems I 
think might arise with the solution.


It's Kind of like parsing that sentence,
    Ron



More information about the Python-ideas mailing list