Author: Armin Rigo <[email protected]>
Branch:
Changeset: r77749:6bfb2b6982a7
Date: 2015-06-02 10:15 +0200
http://bitbucket.org/pypy/pypy/changeset/6bfb2b6982a7/
Log: Mention the modern multiple-list-types-friendly variant and not at
all the prebuilt TimSort class.
diff --git a/rpython/doc/rlib.rst b/rpython/doc/rlib.rst
--- a/rpython/doc/rlib.rst
+++ b/rpython/doc/rlib.rst
@@ -15,14 +15,17 @@
listsort
--------
-The :source:`rpython/rlib/listsort.py` module contains an implementation of
the timsort sorting algorithm
-(the sort method of lists is not RPython). To use it, subclass from the
-``listsort.TimSort`` class and override the ``lt`` method to change the
-comparison behaviour. The constructor of ``TimSort`` takes a list as an
-argument, which will be sorted in place when the ``sort`` method of the
-``TimSort`` instance is called. **Warning:** currently only one type of list
can
-be sorted using the ``listsort`` module in one program, otherwise the annotator
-will be confused.
+The :source:`rpython/rlib/listsort.py` module contains an implementation
+of the timsort sorting algorithm (the sort method of lists is not
+RPython). To use it, make (globally) one class by calling ``MySort =
+listsort.make_timsort_class(lt=my_comparison_func)``. There are also
+other optional arguments, but usually you give with ``lt=...`` a
+function that compares two objects from your lists. You need one class
+per "type" of list and per comparison function.
+
+The constructor of ``MySort`` takes a list as an argument, which will be
+sorted in place when the ``sort`` method of the ``MySort`` instance is
+called.
nonconst
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit