From 0ef956f9974c649bfc64550f8597cec13cfe21f8 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Sun, 21 Nov 2010 23:23:29 +0000 Subject: Issue 6722: Improve the namedtuple examples. --- Doc/library/collections.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst index e34e394..3f81c00 100644 --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -586,11 +586,15 @@ they add the ability to access fields by name instead of position index. .. versionchanged:: 3.1 Added support for *rename*. -Example: .. doctest:: :options: +NORMALIZE_WHITESPACE + >>> # Basic example + >>> Point = namedtuple('Point', 'x y') + >>> p = Point(x=10, y=11) + + >>> # Example using the verbose option to print the class definition >>> Point = namedtuple('Point', 'x y', verbose=True) class Point(tuple): 'Point(x, y)' -- cgit v0.12