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 danijar
Recipients benjamin.peterson, brett.cannon, danijar, xtreak, yselivanov
Date 2019-04-15.18:27:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1555352851.43.0.0863954988621.issue36637@roundup.psfhosted.org>
In-reply-to
Content
A tuple can be created with or without parentheses:

a = (1, 2, 3)

a = 1, 2, 3

While both are intuitive in this example, omitting the parentheses can lead to hard to find errors when there is only one element:

a = (1,)

a = 1,

The first is clear but the second can easily occur as a typo when the programmer actually just wanted to assign an integer (comma is next to enter on many keyboards).

I think ideally, omitting parentheses in the single element case would throw a SyntaxError.

On the other hand, I assume that it could be difficult to separate the behavior or tuple creating with an without parentheses, since the parentheses are probably not actually part of the tuple literal.
History
Date User Action Args
2019-04-15 18:27:31danijarsetrecipients: + danijar, brett.cannon, benjamin.peterson, yselivanov, xtreak
2019-04-15 18:27:31danijarsetmessageid: <1555352851.43.0.0863954988621.issue36637@roundup.psfhosted.org>
2019-04-15 18:27:31danijarlinkissue36637 messages
2019-04-15 18:27:31danijarcreate