Andre Roberge <andre.robe...@gmail.com> added the comment:
In the second case, I understand very well that it could have been a set literal. In my (limited) experience, I have never seen a set literal containing a single element obtained from an == comparison. Since dict can be built by using keyword arguments, I tend to assume that using = in an literal that starts with { is meant to be a dict. In >>> ages = {'Alice' = 22} replacing the equal sign by either ==, :, or a comma would generate no SyntaxError. Clearly (in my mind anyway, and in previous Python versions), the "bad token" is the equal sign, and not the string Alice. Here's what I show with friendly: ====== >>> ages = {'Alice'=22} Traceback (most recent call last): File "<friendly-console:1>", line 1 ages = {'Alice'=22} ^ SyntaxError: invalid syntax >>> why() It is possible that you used an equal sign = instead of a colon : to assign values to keys in a dict before or at the position indicated by ^. ===== Admitedly, this suggestion could also be wrong - but the focus on this case (imo) should be on the "bad token" shown, which should be the equal sign. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44180> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com