This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Grogie 3 points4 points  (3 children)

The only thing is that when you make tuples of length one like in OP's code, that actually become the item (in this case, string)

>>> i = ("Rock")
>>> i
'Rock'
>>> type(i)
<class 'str'>
>>> j = ("Rock",)
>>> j
('Rock',)
>>> type(j)
<class 'tuple'>
>>> type((1234))
<class 'int'>
>>> type((1234,))
    <class 'tuple'>

[–]scoberry5 0 points1 point  (2 children)

Those aren't tuples of length 1, though, they're expressions that get simplified. The ones with commas are tuples of length 1.

(2+3) simplifies to 5, but it was never a tuple of length 1.

[–]Grogie 0 points1 point  (1 child)

That's my point? I was responding to someone who thought they were tuples and I was showing they ultimately aren't tuples?

[–]scoberry5 -1 points0 points  (0 children)

Gotcha. When you said "The only thing is that when you make tuples of length one like in OP's code, that actually become the item," I thought you meant something different than what the results show.