[Python-3000-checkins] r59883 - in python/branches/py3k: Doc/library/collections.rst Lib/test/test_import.py Modules/_cursesmodule.c PC/VS8.0/_ctypes.vcproj PCbuild/_ctypes.vcproj Python/import.c Tools/buildbot/build-amd64.bat Tools/buildbot/clea

Neal Norwitz nnorwitz at gmail.com
Thu Jan 10 08:05:51 CET 2008


On Jan 9, 2008 4:10 PM, christian.heimes
<python-3000-checkins at python.org> wrote:
> Author: christian.heimes
> Date: Thu Jan 10 01:10:02 2008
> New Revision: 59883
>
> Log:
> Merged revisions 59864-59882 via svnmerge from
> svn+ssh://pythondev@svn.python.org/python/trunk
>
> ........
> --- python/branches/py3k/Doc/library/collections.rst    (original)
> +++ python/branches/py3k/Doc/library/collections.rst    Thu Jan 10 01:10:02 2008
> @@ -510,7 +510,7 @@
>        Point(x=33, y=22)
>
>        >>> for partnum, record in inventory.items():
> -              inventory[partnum] = record._replace(price=newprices[partnum], timestamp=time.now())
> +      ...     inventory[partnum] = record._replace(price=newprices[partnum], timestamp=time.now())
>
>  .. attribute:: somenamedtuple._fields
>
> @@ -525,7 +525,7 @@
>        >>> Color = namedtuple('Color', 'red green blue')
>        >>> Pixel = namedtuple('Pixel', Point._fields + Color._fields)
>        >>> Pixel(11, 22, 128, 255, 0)
> -      Pixel(x=11, y=22, red=128, green=255, blue=0)'
> +      Pixel(x=11, y=22, red=128, green=255, blue=0)
>
>  To retrieve a field whose name is stored in a string, use the :func:`getattr`
>  function::
> @@ -544,14 +544,14 @@
>  a fixed-width print format::
>
>      >>> class Point(namedtuple('Point', 'x y')):
> -        @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)
> +    ...     @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), Point(9./7,6):
> -            print p
> +    ...     print p

This print should be fixed so it works in 3k.

n


More information about the Python-3000-checkins mailing list