diff options
author | Raymond Hettinger <python@rcn.com> | 2007-12-14 18:08:20 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2007-12-14 18:08:20 (GMT) |
commit | 48eca67ab984e024acdc3ee175d247a30e2ea33f (patch) | |
tree | 40c3da59aba3fc1166e2ef0f40a12ef79f13cb8d /Doc | |
parent | a63f268351ea8116c08f6b9ee1028f5eec3d5158 (diff) | |
download | cpython-48eca67ab984e024acdc3ee175d247a30e2ea33f.zip cpython-48eca67ab984e024acdc3ee175d247a30e2ea33f.tar.gz cpython-48eca67ab984e024acdc3ee175d247a30e2ea33f.tar.bz2 |
Add line spacing for readability
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/collections.rst | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst index c335e40..d5f4283 100644 --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -385,18 +385,25 @@ Example:: >>> Point = namedtuple('Point', 'x y', verbose=True) class Point(tuple): 'Point(x, y)' + __slots__ = () + _fields = ('x', 'y') + def __new__(cls, x, y): return tuple.__new__(cls, (x, y)) + def __repr__(self): return 'Point(x=%r, y=%r)' % self + def _asdict(self): - 'Return a new dict mapping field names to their values' + 'Return a new dict which maps field names to their values' return dict(zip(('x', 'y'), self)) + def _replace(self, **kwds): 'Return a new Point object replacing specified fields with new values' return Point(**dict(zip(('x', 'y'), self), **kwds)) + x = property(itemgetter(0)) y = property(itemgetter(1)) |