New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Python create a tuple with one element in a clean way #47066
Comments
To create a tuple with one element, you need to do this: >>> my_tuple = (1,) # Note the trailing comma after the value 1
>>> type(my_tuple)
<type 'tuple'> But if you do this >>> my_tuple = (1)
>>> type(my_tuple)
<type 'int'> you don't get a tuple. I thought that just putting a value inside ( ) |
But we need parentheses for grouping! |
That's an absolute no-starter. Not the parentheses make the tuple, the |
Just in case the previous comments aren't clear: Would you rather see py> (3+4)*5 or py> (3+4)*5 |
Martin I see the point now. I appologize for not having the clear head |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: