Skip to content

Instantly share code, notes, and snippets.

@jcdyer
Created October 14, 2015 20:20
Show Gist options
  • Save jcdyer/51b25b50c2f94010a70f to your computer and use it in GitHub Desktop.
Save jcdyer/51b25b50c2f94010a70f to your computer and use it in GitHub Desktop.
>>> def f():
... return {1, 2, 3}
...
>>> dis.dis(f)
2 0 LOAD_CONST 1 (1)
3 LOAD_CONST 2 (2)
6 LOAD_CONST 3 (3)
9 BUILD_SET 3
12 RETURN_VALUE
>>> def g():
... return set([1, 2, 3])
...
>>> dis.dis(g)
2 0 LOAD_GLOBAL 0 (set)
3 LOAD_CONST 1 (1)
6 LOAD_CONST 2 (2)
9 LOAD_CONST 3 (3)
12 BUILD_LIST 3
15 CALL_FUNCTION 1
18 RETURN_VALUE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment