[Python-checkins] bpo-14050: Note that not all data can be sorted (GH-15381)
Raymond Hettinger
webhook-mailer at python.org
Thu Aug 22 12:11:39 EDT 2019
https://github.com/python/cpython/commit/4109263a7edce11194e301138cf66fa2d07f7ce4
commit: 4109263a7edce11194e301138cf66fa2d07f7ce4
branch: master
author: Raymond Hettinger <rhettinger at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019-08-22T09:11:35-07:00
summary:
bpo-14050: Note that not all data can be sorted (GH-15381)
files:
M Doc/tutorial/datastructures.rst
diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst
index 01e437bb5da8..a0d56274fd7e 100644
--- a/Doc/tutorial/datastructures.rst
+++ b/Doc/tutorial/datastructures.rst
@@ -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:
More information about the Python-checkins
mailing list