]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-14050: Note that not all data can be sorted (GH-15381) (GH-15395)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 22 Aug 2019 16:39:52 +0000 (09:39 -0700)
committerRaymond Hettinger <rhettinger@users.noreply.github.com>
Thu, 22 Aug 2019 16:39:52 +0000 (09:39 -0700)
(cherry picked from commit 4109263a7edce11194e301138cf66fa2d07f7ce4)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
Doc/tutorial/datastructures.rst

index 01e437bb5da8589fae53a48efb7164c666b50eb9..a0d56274fd7e83a8f1d9d3be86de7ebb8a3c88af 100644 (file)
@@ -125,6 +125,13 @@ only modify the list have no return value printed -- they return the default
 ``None``. [1]_  This is a design principle for all mutable data structures in
 Python.
 
+Another thing you might notice is that not all data can be sorted or
+compared.  For instance, ``[None, 'hello', 10]`` doesn't sort because
+integers can't be compared to strings and *None* can't be compared to
+other types.  Also, there are some types that don't have a defined
+ordering relation.  For example, ``3+4j < 5+7j`` isn't a valid
+comparison.
+
 
 .. _tut-lists-as-stacks: