]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Docs: a brief note in the sets tutorial about order (#145984)
authorNed Batchelder <ned@nedbatchelder.com>
Tue, 17 Mar 2026 09:03:11 +0000 (05:03 -0400)
committerGitHub <noreply@github.com>
Tue, 17 Mar 2026 09:03:11 +0000 (05:03 -0400)
Docs: a brief note in the sets tut about order

Doc/tutorial/datastructures.rst

index eba2474cd4009d2dd16aadce9265ed8fd3eed00b..d3541c604683e4a4df907911506b9fe41cd3ce7a 100644 (file)
@@ -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'}