diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2009-02-01 14:18:10 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2009-02-01 14:18:10 (GMT) |
commit | c48d83402687c0c5d6da1c7bb1a677208effa35e (patch) | |
tree | 3bc0e90855d9d77d2355e0e477c354d765db12b0 /Doc/library | |
parent | c008a176afdef8cb7afc0e48a8fb306f986964e8 (diff) | |
download | cpython-c48d83402687c0c5d6da1c7bb1a677208effa35e.zip cpython-c48d83402687c0c5d6da1c7bb1a677208effa35e.tar.gz cpython-c48d83402687c0c5d6da1c7bb1a677208effa35e.tar.bz2 |
Issue #1717: documentation fixes related to the cmp removal.
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/locale.rst | 11 | ||||
-rw-r--r-- | Doc/library/operator.rst | 6 | ||||
-rw-r--r-- | Doc/library/unittest.rst | 15 |
3 files changed, 18 insertions, 14 deletions
diff --git a/Doc/library/locale.rst b/Doc/library/locale.rst index 381107e..da3a843 100644 --- a/Doc/library/locale.rst +++ b/Doc/library/locale.rst @@ -225,12 +225,11 @@ The :mod:`locale` module defines the following exception and functions: .. function:: strxfrm(string) - .. index:: builtin: cmp - - Transforms a string to one that can be used for the built-in function - :func:`cmp`, and still returns locale-aware results. This function can be used - when the same string is compared repeatedly, e.g. when collating a sequence of - strings. + Transforms a string to one that can be used in locale-aware + comparisons. For example, ``strxfrm(s1) < strxfrm(s2)`` is + equivalent to ``strcoll(s1, s2) < 0``. This function can be used + when the same string is compared repeatedly, e.g. when collating a + sequence of strings. .. function:: format(format, val[, grouping[, monetary]]) diff --git a/Doc/library/operator.rst b/Doc/library/operator.rst index 089c7fa..24ace8b 100644 --- a/Doc/library/operator.rst +++ b/Doc/library/operator.rst @@ -43,9 +43,9 @@ the rich comparison operators they support: equivalent to ``a < b``, ``le(a, b)`` is equivalent to ``a <= b``, ``eq(a, b)`` is equivalent to ``a == b``, ``ne(a, b)`` is equivalent to ``a != b``, ``gt(a, b)`` is equivalent to ``a > b`` and ``ge(a, b)`` is equivalent to ``a - >= b``. Note that unlike the built-in :func:`cmp`, these functions can - return any value, which may or may not be interpretable as a Boolean value. - See :ref:`comparisons` for more information about rich comparisons. + >= b``. Note that these functions can return any value, which may + or may not be interpretable as a Boolean value. See + :ref:`comparisons` for more information about rich comparisons. The logical operations are also generally applicable to all objects, and support diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst index 8c078bc..29a5fd2 100644 --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -327,8 +327,9 @@ will create a test suite that will run ``WidgetTestCase.testDefaultSize()`` and ``WidgetTestCase.testResize``. :class:`TestLoader` uses the ``'test'`` method name prefix to identify test methods automatically. -Note that the order in which the various test cases will be run is determined by -sorting the test function names with the built-in :func:`cmp` function. +Note that the order in which the various test cases will be run is +determined by sorting the test function names with respect to the +built-in ordering for strings. Often it is desirable to group suites of test cases together, so as to run tests for the whole system at once. This is easy, since :class:`TestSuite` instances @@ -921,9 +922,13 @@ subclassing or assignment on an instance: .. attribute:: TestLoader.sortTestMethodsUsing Function to be used to compare method names when sorting them in - :meth:`getTestCaseNames` and all the :meth:`loadTestsFrom\*` methods. The - default value is the built-in :func:`cmp` function; the attribute can also be - set to :const:`None` to disable the sort. + :meth:`getTestCaseNames` and all the :meth:`loadTestsFrom\*` + methods. This should be a function that takes two arguments + ``self`` and ``other``, and returns ``-1`` if ``self`` precedes + ``other`` in the desired ordering, ``1`` if ``other`` precedes + ``self``, and ``0`` if ``self`` and ``other`` are equal. The + default ordering is the built-in ordering for strings. This + attribute can also be set to :const:`None` to disable the sort. .. attribute:: TestLoader.suiteClass |