[Python-ideas] If branch merging
Ethan Furman
ethan at stoneleaf.us
Fri Jun 12 19:21:39 CEST 2015
On 06/12/2015 08:14 AM, Stephen J. Turnbull wrote:
> Ethan Furman writes:
>
>> Likewise:
>>
>> for val in some_iterator:
>> use(val)
>>
>> bar(val)
>>
>> will shadow foo.val
>
> Yes, I understand that. What I don't understand is your statement
> that you would like "if expr as val:" if it *doesn't* shadow.
Ah, I think I see your point. My use of the word "shadow" was in relation to the micro-scope and the previously existing name being shadowed and then un-shadowed when the micro-scope was destroyed.
If we are at module-level (not class nor function) then there should be no shadowing, but a rebinding of the name. Even try/except blocks don't "shadow", but rebind and then delete the name used to
catch the exception.
--
~Ethan~
More information about the Python-ideas
mailing list