For review: PEP 308 - If-then-else expression

James J. Besemer jb at
Tue Feb 11 09:50:21 CET 2003

holger krekel wrote:

> Do you really know the python parser?  
> Your statements are true for more general parsers.  The Python one
> focuses on simplicity (as so many other parts of python do).
> I had a detailed discussion with Andrew Koenig about this, already.

MY MISTAKE.  The pgen program evidently cannot produce unambigous tables from 
the if/else expression form WITHOUT surrounding parentheses.

Most of my background is with LALR(1) parsers, which I am pretty sure can 
handle the ambiguity.  I understand now that Python uses an LL(1) and I did 
not fully appreciate the limitation of that approach.

Looks like it's moot anyway.



James J. Besemer		503-280-0838 voice
2727 NE Skidmore St.		503-280-0375 fax
Portland, Oregon 97211-6557	mailto:jb at	

More information about the Python-list mailing list