Speed of Nested Functions & Lambda Expressions
Terry Jones
terry at jon.es
Fri Dec 7 11:20:12 EST 2007
>>>>> "Duncan" == Duncan Booth <duncan.booth at invalid.invalid> writes:
Duncan> Terry Jones <terry at jon.es> wrote:
>> Duncan Booth wrote:
Duncan> You'll kick yourself for not seeing it.
Duncan> If you changed fn_inner to:
Duncan> def fn_inner():
Duncan> a, v = v, a
Duncan> then you also changed 'a' and 'v' into local variables.
Duncan> LOAD/STORE_FAST is used to access local variables, LOAD/STORE_DEREF
Duncan> are used to access variables in an outer scope.
Argh, yes :-) [Cue background sound of kicking self]
Thanks.
Terry
More information about the Python-list
mailing list