Earlier today, I asked a question about the way Python handles certain kinds of loops. One of the answers contained disassembled versions of my examples.
I'd like to know more. How can I disassemble my own Python code?
Look at the dis module:
def myfunc(alist):
return len(alist)
>>> dis.dis(myfunc)
2 0 LOAD_GLOBAL 0 (len)
3 LOAD_FAST 0 (alist)
6 CALL_FUNCTION 1
9 RETURN_VALUE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With