Files
python-uncompyle6/test/simple_source/comprehension/01_list_comprehension.py
2017-12-01 21:36:23 -05:00

32 lines
545 B
Python

# Simple list commprehensions
#
# Python2 grammar includes:
# list_compr ::= BUILD_LIST_0 list_iter
# list_iter ::= list_for
# list_for ::= expr _for store list_iter JUMP_BACK
# list_iter ::= lc_body
# lc_body ::= expr LIST_APPEND
#
# Python 3 grammar includes:
# listcomp ::= LOAD_LISTCOMP LOAD_CONST MAKE_FUNCTION_0 expr GET_ITER CALL_FUNCTION_1
# Add line spacing to assist in seeing which parts go where
# in assembly and code
[ i
for
i in
(1, 2, 3, 4)
]
[ i+1
for
i in
(1, 2, 3, 4)
]
[ i * i
for
i in
range(4) ]