Mark Dickinson added the comment: > Mark, can you explain why the first example is valid syntax, but the second > one is not:
Looks like Eric beat me to it! As he explained, it's the "maximal munch" rule at work: the tokenizer matches as much as it can for each token. You see similar effects with integer or float literals followed by a keyword starting with 'e' (or 'j', but I don't think we have any of those). >>> 3if 1else 2 File "<stdin>", line 1 3if 1else 2 ^ SyntaxError: invalid token >>> 3if 1 else 2 3 ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21979> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com