Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:

Ah, I see now. I was using an older version of Python and the output of 
dis was different. It didn't recurse in to show the disassembly of the 
code object as well.

> The first block of instructions here are for the def statement, and 
> the second block for the return statement.

The first block of byte code is for the def statement, and the second 
block is for the code object, which may be more than just a return 
statement.

What would you expect the disassembly of this to show?

dis.dis("""
import y
def f(x):
    a = 2*x - 1
    return a**2

print('hello')
""")

Would you expect the disassembled code object to show up in that as 
well? I'm not sure what I would expect.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39800>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to