diff options
author | Hugo <hugovk@users.noreply.github.com> | 2019-08-17 11:52:49 +0300 |
---|---|---|
committer | Hugo <hugovk@users.noreply.github.com> | 2019-08-17 11:52:49 +0300 |
commit | c4562faeb21cb20ad753d207dd292db6f5668f78 (patch) | |
tree | c856e46986711e1d4a9962ec6476ff47581664e0 | |
parent | af387f329f1e9200919890a51b3cace666055d87 (diff) | |
download | natsort-c4562faeb21cb20ad753d207dd292db6f5668f78.tar.gz |
Remove Python 2-only feature from docs
-rw-r--r-- | docs/examples.rst | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/docs/examples.rst b/docs/examples.rst index e44aa1c..eb6aff3 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -264,31 +264,6 @@ need to pass a key to the :meth:`list.sort` method. The function :func:`~natsort_keygen` has the same API as :func:`~natsorted` (minus the `reverse` option). -Natural Sorting with ``cmp`` (Python 2 only) --------------------------------------------- - -.. note:: - This is a Python2-only feature! The :func:`natcmp` function is not - exposed on Python3. Because this documentation is built with - Python3, you will not find :func:`natcmp` in the API. - -If you are using a legacy codebase that requires you to use :func:`cmp` instead -of a key-function, you can use :func:`~natcmp`. - -.. code-block:: pycon - - >>> import sys - >>> a = ['2 ft 7 in', '1 ft 5 in', '10 ft 2 in', '2 ft 11 in', '7 ft 6 in'] - >>> if sys.version_info[0] == 2: - ... from natsort import natcmp - ... sorted(a, cmp=natcmp) - ... else: - ... natsorted(a) # so docstrings don't fail - ['1 ft 5 in', '2 ft 7 in', '2 ft 11 in', '7 ft 6 in', '10 ft 2 in'] - -:func:`natcmp` also accepts an ``alg`` argument so you can customize your -sorting experience. - Sorting Multiple Lists According to a Single List ------------------------------------------------- |