Comprehension with two variables - explanation needed
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Mon Nov 24 17:20:07 EST 2014
Chris Angelico wrote:
> On Mon, Nov 24, 2014 at 3:42 PM, Steven D'Aprano <steve at pearwood.info>
> wrote:
>> Today dis() returns the above, tomorrow it may return:
>>
>> 0 LOAD_GLOBAL 0 (x)
>> 3 INCREMENT
>> 5 RETURN_VALUE
>>
>> (say), and the Python code remains the same even though the byte code is
>> different.
>
> I hope not! The x in the original function was a local, not a global,
D'oh!
I mean, yes, that was a test to see if you were paying attention, and you
have passed! Well done.
*whistles nonchalantly*
--
Steven
More information about the Python-list
mailing list