error in syntax description for comprehensions?

Boylan, Ross Ross.Boylan at ucsf.edu
Thu Mar 30 16:57:33 EDT 2017


https://docs.python.org/3/reference/expressions.html#displays-for-lists-sets-and-dictionaries
describes the syntax for comprehensions as
comprehension ::=  expression comp_for
comp_for      ::=  [ASYNC] "for" target_list "in" or_test [comp_iter]
comp_iter     ::=  comp_for | comp_if
comp_if       ::=  "if" expression_nocond [comp_iter]

Is the comp_for missing an argument after "in"?
One has to follow the definition of or_test and its components, but I can't find anything that results to a single variable or expression.

Actually, I'm not sure what or_test would do there either with or  without an additional element following "in". 

Ross Boylan


More information about the Python-list mailing list