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 sco1
Recipients sco1
Date 2021-04-13.18:27:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1618338439.83.0.0166317758112.issue43833@roundup.psfhosted.org>
In-reply-to
Content
Came across this riddle today:

>>> [0x_for x in (1, 2, 3)]
[15]

Initially I thought this was related to PEP 515 but the unexpected behavior extends to simpler examples as well, such as:

>>> x = 5
>>> 123or x
123
>>> 123and x
5

I'm not familiar enough with C to understand why this is being parsed/tokenized this way, but this seems like it should instead be a SyntaxError. This appears to be fairly old behavior, as the non-underscored version works back to at least 2.7.

And a bonus:

>>> 0x1decade or more
31378142
History
Date User Action Args
2021-04-13 18:27:19sco1setrecipients: + sco1
2021-04-13 18:27:19sco1setmessageid: <1618338439.83.0.0166317758112.issue43833@roundup.psfhosted.org>
2021-04-13 18:27:19sco1linkissue43833 messages
2021-04-13 18:27:19sco1create