Where can I find the formal grammar of Python, specifically, List Comprehension ?
Where can I find the formal grammar of Python, specifically, List Comprehension ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here’s the full grammar (of Python 2.7.3):
http://docs.python.org/reference/grammar.html
The following rules are involved in parsing the general syntax of a list comprehension:
First, to parse the entire expression, which is an
atom:Second, to parse the actual content of the comprehension, the
listmaker, and the rules it uses:Beyond that you go back to general parsing expressions, e.g.
exprlist.