# You can use Python's built-in "dis"
# module to disassemble functions and
# inspect their CPython VM bytecode:
>>> def greet(name):
... return 'Hello, ' + name + '!'
>>> greet('Dan')
'Hello, Dan!'
>>> import dis
>>> dis.dis(greet)
2 0 LOAD_CONST 1 ('Hello, ')
2 LOAD_FAST 0 (name)
4 BINARY_ADD
6 LOAD_CONST 2 ('!')
8 BINARY_ADD
10 RETURN_VALUE
版权归属:
admin
许可协议:
本文使用《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》协议授权
评论区