On Tue, Aug 21, 2018 at 05:45:53PM -0500, Abe Dillon wrote: > Can you explain how far the parser is capable of backtracking?
Its an LL(1) parser, if I recall correctly, so if you look at the details of LL(1) parsing, that should answer the question. https://en.wikipedia.org/wiki/LL_parser But if I'm reading the Wikipedia page correctly, I think the answer is "no backtracking at all". > It seems like <expression> with <signature> would require a similar amount > of backtracking to ternary expressions: > > <expression> if <condition> else <expression> I don't think needs any backtracking. The parser doesn't have to read the "if" and then go back to re-read the previous expression. It can look ahead from the expression by one token, see the "if", and recognise it is a ternary if. -- Steve _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/