Created
January 21, 2015 16:39
-
-
Save sigmaris/561ec0df4686cf756940 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> def f1(y): | |
... return set(x for x in y) | |
... | |
>>> def f2(y): | |
... return {x for x in y} | |
... | |
>>> dis.dis(f1) | |
2 0 LOAD_GLOBAL 0 (set) | |
3 LOAD_CONST 1 (<code object <genexpr> at 0x10abecd30, file "<stdin>", line 2>) | |
6 MAKE_FUNCTION 0 | |
9 LOAD_FAST 0 (y) | |
12 GET_ITER | |
13 CALL_FUNCTION 1 | |
16 CALL_FUNCTION 1 | |
19 RETURN_VALUE | |
>>> dis.dis(f2) | |
2 0 LOAD_CONST 1 (<code object <setcomp> at 0x10ac14130, file "<stdin>", line 2>) | |
3 MAKE_FUNCTION 0 | |
6 LOAD_FAST 0 (y) | |
9 GET_ITER | |
10 CALL_FUNCTION 1 | |
13 RETURN_VALUE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment