]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] Docs: a brief note in the sets tutorial about order (GH-145984) (#146050)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 17 Mar 2026 09:18:16 +0000 (10:18 +0100)
committerGitHub <noreply@github.com>
Tue, 17 Mar 2026 09:18:16 +0000 (05:18 -0400)
Docs: a brief note in the sets tutorial about order (GH-145984)
(cherry picked from commit 4f5e79805ebcaa0d3ba1677694d4120a9e8f4513)

Docs: a brief note in the sets tut about order

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
Doc/tutorial/datastructures.rst

index 7e02e74177c457033c02cf52dfa6b9cf57434fb4..5a239d9e37100060d89273d13fd06fd045580db2 100644 (file)
@@ -454,6 +454,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'}