https://github.com/python/cpython/commit/4f5e79805ebcaa0d3ba1677694d4120a9e8f4513
commit: 4f5e79805ebcaa0d3ba1677694d4120a9e8f4513
branch: main
author: Ned Batchelder <[email protected]>
committer: nedbat <[email protected]>
date: 2026-03-17T05:03:11-04:00
summary:
Docs: a brief note in the sets tutorial about order (#145984)
Docs: a brief note in the sets tut about order
files:
M Doc/tutorial/datastructures.rst
diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst
index eba2474cd4009d..d3541c604683e4 100644
--- a/Doc/tutorial/datastructures.rst
+++ b/Doc/tutorial/datastructures.rst
@@ -493,6 +493,9 @@ Curly braces or the :func:`set` function can be used to
create sets. Note: to
create an empty set you have to use ``set()``, not ``{}``; the latter creates
an
empty dictionary, a data structure that we discuss in the next section.
+Because sets are unordered, iterating over them or printing them can
+produce the elements in a different order than you expect.
+
Here is a brief demonstration::
>>> basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'}
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]