Doubt about closure/function generation in bytecode
Is there any semantic difference between
BUILD_TUPLE 0
LOAD_CONST
MAKE_CLOSURE 0
and
LOAD_CONST
MAKE_FUNCTION 0
?
In other words is there any difference between a function and a closure
that doesn't capture anything? Is it just a speed optimization for a common
case?
Andrea Griffini
2013/7/12 Andrea Griffini
Is there any semantic difference between
BUILD_TUPLE 0 LOAD_CONST
MAKE_CLOSURE 0
and
LOAD_CONST
MAKE_FUNCTION 0
?
In other words is there any difference between a function and a closure that doesn't capture anything? Is it just a speed optimization for a common case?
It probably has more to do with the fact that nested scopes with added much later in Python's history than functions.
-- Regards, Benjamin
participants (2)
-
Andrea Griffini
-
Benjamin Peterson