[Python-checkins] r67669 - in python/branches/py3k-issue1717/Doc: c-api/typeobj.rst includes/sqlite3/collation_reverse.py library/locale.rst library/operator.rst reference/expressions.rst tutorial/modules.rst

mark.dickinson python-checkins at python.org
Mon Dec 8 21:26:27 CET 2008


Author: mark.dickinson
Date: Mon Dec  8 21:26:26 2008
New Revision: 67669

Log:
Remove more references to cmp in the docs;  fix typo in typeobject.rst.


Modified:
   python/branches/py3k-issue1717/Doc/c-api/typeobj.rst
   python/branches/py3k-issue1717/Doc/includes/sqlite3/collation_reverse.py
   python/branches/py3k-issue1717/Doc/library/locale.rst
   python/branches/py3k-issue1717/Doc/library/operator.rst
   python/branches/py3k-issue1717/Doc/reference/expressions.rst
   python/branches/py3k-issue1717/Doc/tutorial/modules.rst

Modified: python/branches/py3k-issue1717/Doc/c-api/typeobj.rst
==============================================================================
--- python/branches/py3k-issue1717/Doc/c-api/typeobj.rst	(original)
+++ python/branches/py3k-issue1717/Doc/c-api/typeobj.rst	Mon Dec  8 21:26:26 2008
@@ -244,7 +244,7 @@
    the subtype's :attr:`tp_setattr` and :attr:`tp_setattro` are both *NULL*.
 
 
-.. cmember:: void PyTypeObject.tp_reserved
+.. cmember:: void* PyTypeObject.tp_reserved
 
    Reserved slot, formaly known as tp_compare.
 

Modified: python/branches/py3k-issue1717/Doc/includes/sqlite3/collation_reverse.py
==============================================================================
--- python/branches/py3k-issue1717/Doc/includes/sqlite3/collation_reverse.py	(original)
+++ python/branches/py3k-issue1717/Doc/includes/sqlite3/collation_reverse.py	Mon Dec  8 21:26:26 2008
@@ -1,7 +1,12 @@
 import sqlite3
 
 def collate_reverse(string1, string2):
-    return -cmp(string1, string2)
+    if string1 == string2:
+        return 0
+    elif string1 < string2:
+        return 1
+    else:
+        return -1
 
 con = sqlite3.connect(":memory:")
 con.create_collation("reverse", collate_reverse)

Modified: python/branches/py3k-issue1717/Doc/library/locale.rst
==============================================================================
--- python/branches/py3k-issue1717/Doc/library/locale.rst	(original)
+++ python/branches/py3k-issue1717/Doc/library/locale.rst	Mon Dec  8 21:26:26 2008
@@ -225,12 +225,11 @@
 
 .. 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]])

Modified: python/branches/py3k-issue1717/Doc/library/operator.rst
==============================================================================
--- python/branches/py3k-issue1717/Doc/library/operator.rst	(original)
+++ python/branches/py3k-issue1717/Doc/library/operator.rst	Mon Dec  8 21:26:26 2008
@@ -43,9 +43,9 @@
    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

Modified: python/branches/py3k-issue1717/Doc/reference/expressions.rst
==============================================================================
--- python/branches/py3k-issue1717/Doc/reference/expressions.rst	(original)
+++ python/branches/py3k-issue1717/Doc/reference/expressions.rst	Mon Dec  8 21:26:26 2008
@@ -1022,8 +1022,8 @@
   length.
 
   If not equal, the sequences are ordered the same as their first differing
-  elements.  For example, ``cmp([1,2,x], [1,2,y])`` returns the same as
-  ``cmp(x,y)``.  If the corresponding element does not exist, the shorter
+  elements.  For example, ``[1,2,x] <= [1,2,y]`` has the same value as
+  ``x <= y``.  If the corresponding element does not exist, the shorter
   sequence is ordered first (for example, ``[1,2] < [1,2,3]``).
 
 * Mappings (dictionaries) compare equal if and only if their sorted ``(key,

Modified: python/branches/py3k-issue1717/Doc/tutorial/modules.rst
==============================================================================
--- python/branches/py3k-issue1717/Doc/tutorial/modules.rst	(original)
+++ python/branches/py3k-issue1717/Doc/tutorial/modules.rst	Mon Dec  8 21:26:26 2008
@@ -317,25 +317,25 @@
    >>> dir(builtins)
 
    ['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'Buffer
-   Error', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError', 'Excep   
-   tion', 'False', 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'IOError   
-   ', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexError', 'KeyError',   
-    'KeyboardInterrupt', 'LookupError', 'MemoryError', 'NameError', 'None', 'NotImp   
-   lemented', 'NotImplementedError', 'OSError', 'OverflowError', 'PendingDeprecatio   
-   nWarning', 'ReferenceError', 'RuntimeError', 'RuntimeWarning', 'StopIteration',   
-   'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'True',   
-    'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError', '   
-   UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning', 'ValueE   
-   rror', 'Warning', 'ZeroDivisionError', '__build_class__', '__debug__', '__doc__'   
-   , '__import__', '__name__', 'abs', 'all', 'any', 'basestring', 'bin', 'bool', 'b   
-   uffer', 'bytes', 'chr', 'chr8', 'classmethod', 'cmp', 'compile', 'complex', 'cop   
-   yright', 'credits', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'ex   
-   ec', 'exit', 'filter', 'float', 'frozenset', 'getattr', 'globals', 'hasattr', 'h   
-   ash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', '   
-   len', 'license', 'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next', 'o   
-   bject', 'oct', 'open', 'ord', 'pow', 'print', 'property', 'quit', 'range', 'repr   
-   ', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'st   
-   r', 'str8', 'sum', 'super', 'trunc', 'tuple', 'type', 'vars', 'zip']   
+   Error', 'BytesWarning', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'Environme
+   ntError', 'Exception', 'False', 'FloatingPointError', 'FutureWarning', 'Generato
+   rExit', 'IOError', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexErr
+   or', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'NameError',
+    'None', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'P
+   endingDeprecationWarning', 'ReferenceError', 'RuntimeError', 'RuntimeWarning', '
+   StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'Ta
+   bError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'Unicod
+   eEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserW
+   arning', 'ValueError', 'Warning', 'ZeroDivisionError', '__build_class__', '__deb
+   ug__', '__doc__', '__import__', '__name__', '__package__', 'abs', 'all', 'any', 
+   'ascii', 'bin', 'bool', 'bytearray', 'bytes', 'chr', 'classmethod', 'compile', '
+   complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod', 'enumerate
+   ', 'eval', 'exec', 'exit', 'filter', 'float', 'format', 'frozenset', 'getattr', 
+   'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance',
+    'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'map', 'max', 'memory
+   view', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property'
+   , 'quit', 'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sort
+   ed', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars', 'zip']
 
 .. _tut-packages:
 


More information about the Python-checkins mailing list