[Chris Angelico] > I have to defer to someone who knows in more detail here, but the > parser will look ahead one "token", whatever a token is. (Technically > it doesn't backtrack, it looks ahead - same difference.) In order for > the ternary-if to work, the expression before the if has to be of a > more restricted type than just "any expression" (for instance, you > can't put a lambda function there, unless you parenthesize it).
Interesting. I really need to try delving into the nuts and bolts of Python. I didn't know that about ternary expressions. I don't know if you saw my recent discussion with Jonathan Fine, but he brought up some good points too.
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/