Steven D'Aprano added the comment:
> My confusion stems from the fact that I expected the unpacking of a
> set to return the same output as that obtained from the unpacking of a
> list.
Why did you expect that?
Sets aren't lists. Lists are ordered, so they hold their items in a
specific or
Cat Chenal added the comment:
Thank you for pointing out my lack of clarity: I apologize.
I probably should not have split this issue in two (issue38855).
My confusion stems from the fact that I expected the unpacking of a set to
return the same output as that obtained from the unpacking of a
Josh Rosenberg added the comment:
To be clear, the docstring is explicitly disclaiming any ordering contract. If
you're reading "unordered" as meaning "not reordered" (like a list or tuple,
where the elements appear in insertion order), that's not what "unordered"
means here. It means "arbit
Steven D'Aprano added the comment:
I'm sorry, I don't understand what part of the documentation you think is
violated here. The docs say that sets are unordered, but of course when
printing the elements have to be given in *some* order.
The given output seems unordered to me: -1 is smaller t
New submission from Cat Chenal :
S = {19,8,-1,25,0,1,2,3,4,5,6,7}
print('Set S = {{19,8,-1,25,0,1,2,3,4,5,6,7}}')
The set is represented by a new string-ordered set:
print(f'Its repr is:\n{S}\n')
Output:
{0, 1, 2, 3, 4, 5, 6, 7, 8, 19, 25, -1}
This is a breach of the contract stated in the doc