Skip to content

Commit 2efea85

Browse files
rhettingerlisroach
authored andcommitted
bpo-14050: Note that not all data can be sorted (pythonGH-15381)
1 parent e7befd3 commit 2efea85

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Doc/tutorial/datastructures.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ only modify the list have no return value printed -- they return the default
125125
``None``. [1]_ This is a design principle for all mutable data structures in
126126
Python.
127127

128+
Another thing you might notice is that not all data can be sorted or
129+
compared. For instance, ``[None, 'hello', 10]`` doesn't sort because
130+
integers can't be compared to strings and *None* can't be compared to
131+
other types. Also, there are some types that don't have a defined
132+
ordering relation. For example, ``3+4j < 5+7j`` isn't a valid
133+
comparison.
134+
128135

129136
.. _tut-lists-as-stacks:
130137

0 commit comments

Comments
 (0)