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.

classification
Title: Sets are storing elements in sorted order.
Type: resource usage Stage: resolved
Components: Documentation Versions: Python 3.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, piyushpravin1998, steven.daprano
Priority: normal Keywords:

Created on 2020-08-28 13:47 by piyushpravin1998, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
dndndgndghbdgngdndgngtn.PNG piyushpravin1998, 2020-08-28 13:47
Messages (3)
msg376037 - (view) Author: Piyush Pravin (piyushpravin1998) Date: 2020-08-28 13:47
In documentation it is written that " Sets are unordered collection", but actually it is storing the elements in sorted order.
msg376039 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2020-08-28 14:07
"Unordered" means that the language doesn't promise any specific order, it doesn't mean that there is no order at all.

Try strings:

py> set("abcdef")
{'b', 'f', 'c', 'e', 'd', 'a'}


or different ints:

py> set([1, 0, -2])
{0, 1, -2}
msg376040 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2020-08-28 14:17
Here's another example:

py> set([1, 2**63, 4, -5, 6, 5])
{1, 9223372036854775808, 4, 6, 5, -5}



By the way, in the future, please don't post screen shots of text, copy the code and output and paste it as text into your bug report. Screenshots make it hard for us to reproduce the bug, we have to re-type your code. And it makes it difficult for blind and visually impaired developers, who may be reading this with a screen-reader.
History
Date User Action Args
2022-04-11 14:59:35adminsetgithub: 85822
2020-08-28 14:17:38steven.dapranosetmessages: + msg376040
2020-08-28 14:07:37steven.dapranosetstatus: open -> closed

nosy: + steven.daprano
messages: + msg376039

resolution: not a bug
stage: resolved
2020-08-28 13:47:27piyushpravin1998create