Message393971
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. |
|
Date |
User |
Action |
Args |
2021-05-19 19:46:23 | aroberge | set | recipients:
+ aroberge, lys.nikolaou, pablogsal, shreyanavigyan |
2021-05-19 19:46:23 | aroberge | set | messageid: <1621453583.51.0.831282467856.issue44180@roundup.psfhosted.org> |
2021-05-19 19:46:23 | aroberge | link | issue44180 messages |
2021-05-19 19:46:23 | aroberge | create | |
|