def list_comprehension(v):
return [x * v for x in range(3)]
t = traceur.DummyTrace(list_comprehension)
t.call(10)
t.do_report()
# === Result: ===
=== Entering New Frame list_comprehension (11094456) ===
[]
1 LOAD_CLOSURE 0 v
[<cell at 0x7f23eff0fad8: int object at 0x975210>]
5 BUILD_TUPLE 1 1
[(<cell at 0x7f23eff0fad8: int object at 0x975210>,)]
9 LOAD_CONST 1 <code object <listcomp> at 0x7f23efe0ef40, file "test.py", line 62>
[<code object <listcomp> at 0x7f23efe0ef40, file "test.py", line 62>, (<cell at 0x7f23eff0fad8: int object at 0x975210>,)]
13 LOAD_CONST 2 list_comprehension.<locals>.<listcomp>
['list_comprehension.<locals>.<listcomp>', <code object <listcomp> at 0x7f23efe0ef40, file "test.py", line 62>, (<cell at 0x7f23eff0fad8: int object at 0x975210>,)]
17 MAKE_CLOSURE 0 0
[<function list_comprehension.<locals>.<listcomp> at 0x7f23efe713f0>]
21 LOAD_GLOBAL 0 range
[<class 'range'>, <function list_comprehension.<locals>.<listcomp> at 0x7f23efe713f0>]
25 LOAD_CONST 3 3
[3, <class 'range'>, <function list_comprehension.<locals>.<listcomp> at 0x7f23efe713f0>]
29 CALL_FUNCTION 1 1
[range(0, 3), <function list_comprehension.<locals>.<listcomp> at 0x7f23efe713f0>]
33 GET_ITER None None
[<range_iterator object at 0x7f23efd8a4c0>, <function list_comprehension.<locals>.<listcomp> at 0x7f23efe713f0>]
35 CALL_FUNCTION 1 1
=== Entering New Frame <listcomp> (11120808) ===
[]
1 BUILD_LIST 0 0
[[]]
5 LOAD_FAST 0 .0
[<range_iterator object at 0x7f23efd8a4c0>, []]
9 FOR_ITER 22 34
[0, <range_iterator object at 0x7f23efd8a4c0>, []]
13 STORE_FAST 1 x
[<range_iterator object at 0x7f23efd8a4c0>, []]
17 LOAD_FAST 1 x
[0, <range_iterator object at 0x7f23efd8a4c0>, []]
21 LOAD_DEREF 0 v
[10, 0, <range_iterator object at 0x7f23efd8a4c0>, []]
25 BINARY_MULTIPLY None None
[0, <range_iterator object at 0x7f23efd8a4c0>, []]
27 LIST_APPEND 2 2
[<range_iterator object at 0x7f23efd8a4c0>, [0]]
31 JUMP_ABSOLUTE 8 8
[<range_iterator object at 0x7f23efd8a4c0>, [0]]
9 FOR_ITER 22 34
[1, <range_iterator object at 0x7f23efd8a4c0>, [0]]
13 STORE_FAST 1 x
[<range_iterator object at 0x7f23efd8a4c0>, [0]]
17 LOAD_FAST 1 x
[1, <range_iterator object at 0x7f23efd8a4c0>, [0]]
21 LOAD_DEREF 0 v
[10, 1, <range_iterator object at 0x7f23efd8a4c0>, [0]]
25 BINARY_MULTIPLY None None
[10, <range_iterator object at 0x7f23efd8a4c0>, [0]]
27 LIST_APPEND 2 2
[<range_iterator object at 0x7f23efd8a4c0>, [0, 10]]
31 JUMP_ABSOLUTE 8 8
[<range_iterator object at 0x7f23efd8a4c0>, [0, 10]]
9 FOR_ITER 22 34
[2, <range_iterator object at 0x7f23efd8a4c0>, [0, 10]]
13 STORE_FAST 1 x
[<range_iterator object at 0x7f23efd8a4c0>, [0, 10]]
17 LOAD_FAST 1 x
[2, <range_iterator object at 0x7f23efd8a4c0>, [0, 10]]
21 LOAD_DEREF 0 v
[10, 2, <range_iterator object at 0x7f23efd8a4c0>, [0, 10]]
25 BINARY_MULTIPLY None None
[20, <range_iterator object at 0x7f23efd8a4c0>, [0, 10]]
27 LIST_APPEND 2 2
[<range_iterator object at 0x7f23efd8a4c0>, [0, 10, 20]]
31 JUMP_ABSOLUTE 8 8
[<range_iterator object at 0x7f23efd8a4c0>, [0, 10, 20]]
9 FOR_ITER 22 34
[[0, 10, 20]]
35 RETURN_VALUE None None
=== Returning to Frame list_comprehension 11094456===
[[0, 10, 20]]
39 RETURN_VALUE None None