[Python-checkins] cpython (merge 3.2 -> default): Forward port doc update.

raymond.hettinger python-checkins at python.org
Wed Mar 16 02:21:22 CET 2011


http://hg.python.org/cpython/rev/36202463a9d0
changeset:   68582:36202463a9d0
parent:      68576:60866549e653
parent:      68578:6544accfefc3
user:        Raymond Hettinger <python at rcn.com>
date:        Tue Mar 15 18:19:52 2011 -0700
summary:
  Forward port doc update.

files:
  Doc/library/collections.rst

diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -706,7 +706,7 @@
    :options: +NORMALIZE_WHITESPACE
 
    >>> # Basic example
-   >>> Point = namedtuple('Point', 'x y')
+   >>> Point = namedtuple('Point', ['x', 'y'])
    >>> p = Point(x=10, y=11)
 
    >>> # Example using the verbose option to print the class definition
@@ -851,15 +851,15 @@
 a fixed-width print format:
 
     >>> class Point(namedtuple('Point', 'x y')):
-    ...     __slots__ = ()
-    ...     @property
-    ...     def hypot(self):
-    ...         return (self.x ** 2 + self.y ** 2) ** 0.5
-    ...     def __str__(self):
-    ...         return 'Point: x=%6.3f  y=%6.3f  hypot=%6.3f' % (self.x, self.y, self.hypot)
+            __slots__ = ()
+            @property
+            def hypot(self):
+                return (self.x ** 2 + self.y ** 2) ** 0.5
+            def __str__(self):
+                return 'Point: x=%6.3f  y=%6.3f  hypot=%6.3f' % (self.x, self.y, self.hypot)
 
     >>> for p in Point(3, 4), Point(14, 5/7):
-    ...     print(p)
+            print(p)
     Point: x= 3.000  y= 4.000  hypot= 5.000
     Point: x=14.000  y= 0.714  hypot=14.018
 
@@ -886,7 +886,7 @@
     >>> Status.open, Status.pending, Status.closed
     (0, 1, 2)
     >>> class Status:
-    ...     open, pending, closed = range(3)
+            open, pending, closed = range(3)
 
 .. seealso::
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list