You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-03 00:45:53 +08:00
32 lines
545 B
Python
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) ]
|