[Python-Dev] Doubt about closure/function generation in bytecode

Andrea Griffini agriff at tin.it
Sat Jul 13 08:41:55 CEST 2013


Is there any semantic difference between

    BUILD_TUPLE 0
    LOAD_CONST <code object ... >
    MAKE_CLOSURE 0

and

    LOAD_CONST <code object ...>
    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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130713/1989c40d/attachment.html>


More information about the Python-Dev mailing list