Skip to content

Instantly share code, notes, and snippets.

@klange
Last active January 1, 2021 01:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klange/6ef2e320dce56bd048da860e64201ed8 to your computer and use it in GitHub Desktop.
Save klange/6ef2e320dce56bd048da860e64201ed8 to your computer and use it in GitHub Desktop.
>>> l[1]++
| [ *<closure <def <module>>> ]
0000 1 OP_GET_GLOBAL 0 '"l"' (type=String)
| [ *<closure <def <module>>> ][ <instance of list> ]
0002 | OP_DUP 0
| [ *<closure <def <module>>> ][ <instance of list> ][ <instance of list> ]
0004 | OP_CONSTANT 1 '1' (type=Integer)
| [ *<closure <def <module>>> ][ <instance of list> ][ <instance of list> ][ 1 ]
0006 | OP_SWAP 1
| [ *<closure <def <module>>> ][ <instance of list> ][ 1 ][ <instance of list> ]
0008 | OP_GET_PROPERTY 2 '"__get__"' (type=String)
| [ *<closure <def <module>>> ][ <instance of list> ][ 1 ][ <bound <def __get__>> ]
0010 | OP_DUP 1
| [ *<closure <def <module>>> ][ <instance of list> ][ 1 ][ <bound <def __get__>> ][ 1 ]
0012 | OP_CALL 1
| [ <closure <def <module>>> ][ <instance of list> ][ 1 ][ *<instance of list> ][ 1 ]
0000 6 OP_GET_GLOBAL 0 '"__builtins__"' (type=String)
| [ <closure <def <module>>> ][ <instance of list> ][ 1 ][ *<instance of list> ][ 1 ][ <instance of object> ]
0002 | OP_GET_PROPERTY 1 '"list_get"' (type=String)
| [ <closure <def <module>>> ][ <instance of list> ][ 1 ][ *<instance of list> ][ 1 ][ <native bind> ]
0004 | OP_GET_LOCAL 0
| [ <closure <def <module>>> ][ <instance of list> ][ 1 ][ *<instance of list> ][ 1 ][ <native bind> ][ <instance of list> ]
0006 | OP_GET_PROPERTY 2 '"_list"' (type=String)
| [ <closure <def <module>>> ][ <instance of list> ][ 1 ][ *<instance of list> ][ 1 ][ <native bind> ][ <module> ]
0008 | OP_GET_LOCAL 1
| [ <closure <def <module>>> ][ <instance of list> ][ 1 ][ *<instance of list> ][ 1 ][ <native bind> ][ <module> ][ 1 ]
0010 | OP_CALL 2
| [ <closure <def <module>>> ][ <instance of list> ][ 1 ][ *<instance of list> ][ 1 ][ 3 ]
0012 | OP_RETURN
| [ *<closure <def <module>>> ][ <instance of list> ][ 1 ][ 3 ]
0014 | OP_CONSTANT 3 '1' (type=Integer)
| [ *<closure <def <module>>> ][ <instance of list> ][ 1 ][ 3 ][ 1 ]
0016 | OP_ADD
| [ *<closure <def <module>>> ][ <instance of list> ][ 1 ][ 4 ]
0017 | OP_DUP 2
| [ *<closure <def <module>>> ][ <instance of list> ][ 1 ][ 4 ][ <instance of list> ]
0019 | OP_GET_PROPERTY 4 '"__set__"' (type=String)
| [ *<closure <def <module>>> ][ <instance of list> ][ 1 ][ 4 ][ <bound <def __set__>> ]
0021 | OP_SWAP 3
| [ *<closure <def <module>>> ][ <bound <def __set__>> ][ 1 ][ 4 ][ <instance of list> ]
0023 | OP_POP
| [ *<closure <def <module>>> ][ <bound <def __set__>> ][ 1 ][ 4 ]
0024 | OP_CALL 2
| [ <closure <def <module>>> ][ *<instance of list> ][ 1 ][ 4 ]
0000 8 OP_GET_GLOBAL 0 '"__builtins__"' (type=String)
| [ <closure <def <module>>> ][ *<instance of list> ][ 1 ][ 4 ][ <instance of object> ]
0002 | OP_GET_PROPERTY 1 '"list_set"' (type=String)
| [ <closure <def <module>>> ][ *<instance of list> ][ 1 ][ 4 ][ <native bind> ]
0004 | OP_GET_LOCAL 0
| [ <closure <def <module>>> ][ *<instance of list> ][ 1 ][ 4 ][ <native bind> ][ <instance of list> ]
0006 | OP_GET_PROPERTY 2 '"_list"' (type=String)
| [ <closure <def <module>>> ][ *<instance of list> ][ 1 ][ 4 ][ <native bind> ][ <module> ]
0008 | OP_GET_LOCAL 1
| [ <closure <def <module>>> ][ *<instance of list> ][ 1 ][ 4 ][ <native bind> ][ <module> ][ 1 ]
0010 | OP_GET_LOCAL 2
| [ <closure <def <module>>> ][ *<instance of list> ][ 1 ][ 4 ][ <native bind> ][ <module> ][ 1 ][ 4 ]
0012 | OP_CALL 3
| [ <closure <def <module>>> ][ *<instance of list> ][ 1 ][ 4 ][ True ]
0014 | OP_RETURN
| [ *<closure <def <module>>> ][ True ]
0026 | OP_POP
| [ *<closure <def <module>>> ]
>>> o.foo++
| [ *<closure <def <module>>> ]
0000 1 OP_GET_GLOBAL 0 '"o"' (type=String)
| [ *<closure <def <module>>> ][ <instance of object> ]
0002 | OP_DUP 0
| [ *<closure <def <module>>> ][ <instance of object> ][ <instance of object> ]
0004 | OP_GET_PROPERTY 1 '"foo"' (type=String)
| [ *<closure <def <module>>> ][ <instance of object> ][ 1 ]
0006 | OP_CONSTANT 2 '1' (type=Integer)
| [ *<closure <def <module>>> ][ <instance of object> ][ 1 ][ 1 ]
0008 | OP_ADD
| [ *<closure <def <module>>> ][ <instance of object> ][ 2 ]
0009 | OP_SET_PROPERTY 1 '"foo"' (type=String)
| [ *<closure <def <module>>> ][ 2 ]
0011 | OP_POP
>>> x++
| [ *<closure <def <module>>> ]
0000 1 OP_GET_GLOBAL 0 '"x"' (type=String)
| [ *<closure <def <module>>> ][ 1 ]
0002 | OP_CONSTANT 1 '1' (type=Integer)
| [ *<closure <def <module>>> ][ 1 ][ 1 ]
0004 | OP_ADD
| [ *<closure <def <module>>> ][ 2 ]
0005 | OP_SET_GLOBAL 0 '"x"' (type=String)
| [ *<closure <def <module>>> ][ 2 ]
0007 | OP_POP
| [ *<closure <def <module>>> ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment