This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author aroberge
Recipients aroberge, lys.nikolaou, pablogsal, shreyanavigyan
Date 2021-05-19.19:46:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1621453583.51.0.831282467856.issue44180@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-05-19 19:46:23arobergesetrecipients: + aroberge, lys.nikolaou, pablogsal, shreyanavigyan
2021-05-19 19:46:23arobergesetmessageid: <1621453583.51.0.831282467856.issue44180@roundup.psfhosted.org>
2021-05-19 19:46:23arobergelinkissue44180 messages
2021-05-19 19:46:23arobergecreate