Status of PEP's?

David Eppstein eppstein at ics.uci.edu
Mon Mar 4 23:30:15 EST 2002


In article <3C8445FC.A1816810 at cosc.canterbury.ac.nz>,
 Greg Ewing <greg at cosc.canterbury.ac.nz> wrote:

> So it seems that the following would work:
> 
>   for_stmt: 'for' (exprlist 'in' testlist 
>       | exprlist lt_op exprlist lt_op exprlist
>       | exprlist gt_op exprlist gt_op exprlist) ':' suite ['else' ':'
> suite]
> 
>   lt_op: '<' | '<='
>   gt_op: '>' | '>='

Yes, I have something much like this in the draft PEP I am working on.  
But the outer expressions should be or_expr to respect Python's 
precedence rules, and the inner one should be identifier.

> Later phases of the compiler would be responsible for checking
> that the exprlists in the new parts actually contain only one
> item each, and that the middle one is a variable.

Checking that the outer expressions contain one item rather than a tuple 
needs to be done at run time.  Of course, the compiler can catch some 
instances where the expression is obviously non-single.



More information about the Python-list mailing list