Dec-14-2018, 06:00 AM
(This post was last modified: Dec-14-2018, 06:00 AM by Gribouillis.)
Skaperen Wrote:i've noted that a few posts show that some of you know about expressing an assembly-like language that expresses what goes on inside Python (or at least inside CPython).Do you mean bytecode? Try the dis module
>>> import dis >>> dis.dis("mydict[x] = y") 1 0 LOAD_NAME 0 (y) 3 LOAD_NAME 1 (mydict) 6 LOAD_NAME 2 (x) 9 STORE_SUBSCR 10 LOAD_CONST 0 (None) 13 RETURN_VALUE >>> dis.dis("y = mydict[x]") 1 0 LOAD_NAME 0 (mydict) 3 LOAD_NAME 1 (x) 6 BINARY_SUBSCR 7 STORE_NAME 2 (y) 10 LOAD_CONST 0 (None) 13 RETURN_VALUE