ast Python , , ListComp .
, , Python, stdin:
import ast
import sys
prog = ast.parse(sys.stdin.read())
listComps = (node for node in ast.walk(prog) if type(node) is ast.ListComp)
for comp in listComps:
print "List comprehension at line %d" % comp.lineno