Skip to content

Commit 4601007

Browse files
[3.14] Docs: a brief note in the sets tutorial about order (GH-145984) (#146049)
Docs: a brief note in the sets tutorial about order (GH-145984) (cherry picked from commit 4f5e798) Docs: a brief note in the sets tut about order Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
1 parent f06961e commit 4601007

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Doc/tutorial/datastructures.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,9 @@ Curly braces or the :func:`set` function can be used to create sets. Note: to
454454
create an empty set you have to use ``set()``, not ``{}``; the latter creates an
455455
empty dictionary, a data structure that we discuss in the next section.
456456

457+
Because sets are unordered, iterating over them or printing them can
458+
produce the elements in a different order than you expect.
459+
457460
Here is a brief demonstration::
458461

459462
>>> basket = {'apple', 'orange', 'apple', 'pear', 'orange', 'banana'}

0 commit comments

Comments
 (0)