bpo-14050: Note that not all data can be sorted by rhettinger · Pull Request #15381 · python/cpython (original) (raw)

This note on the documentation tutorial makes a lot of sense to me but shouldn't we say that it would fail when trying to sort?
When I read that this suggested me it wouldn't sort it but not that it would fail when trying to do so:

>>> a.sort()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: '<' not supported between instances of 'int' and 'NoneType'

Maybe changing this:

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.

for

For instance, ``[None, 'hello', 10]`` will fail when trying to sort because integers can't be compared to strings and *None* can't be compared to other types.

Not sure if in that part of the tutorial is too early to say will raise a TypeError Exception.
Nonetheless I think is a pretty good addition to the tutorial.