summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2007-10-08 09:14:28 (GMT)
committerRaymond Hettinger <python@rcn.com>2007-10-08 09:14:28 (GMT)
commit2115bbc4da683e6878b361a80c74203a2559e61d (patch)
tree6336a03ba5981375fed9fb7d88f287535a0fcf57 /Doc
parenta970c2216645a86b532f68bfb93b8ec9da858b0d (diff)
downloadcpython-2115bbc4da683e6878b361a80c74203a2559e61d.zip
cpython-2115bbc4da683e6878b361a80c74203a2559e61d.tar.gz
cpython-2115bbc4da683e6878b361a80c74203a2559e61d.tar.bz2
Add comments to NamedTuple code.
Let the field spec be either a string or a non-string sequence (suggested by Martin Blais with use cases). Improve the error message in the case of a SyntaxError (caused by a duplicate field name).
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/collections.rst8
1 files changed, 5 insertions, 3 deletions
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
index fc5bbeb..5da7b60 100644
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -363,9 +363,11 @@ they add the ability to access fields by name instead of position index.
helpful docstring (with typename and fieldnames) and a helpful :meth:`__repr__`
method which lists the tuple contents in a ``name=value`` format.
- The *fieldnames* are specified in a single string with each fieldname separated by
- a space and/or comma. Any valid Python identifier may be used for a fieldname
- except for names starting and ending with double underscores.
+ The *fieldnames* are a single string with each fieldname separated by a space
+ and/or comma (for example "x y" or "x, y"). Alternately, the *fieldnames*
+ can be specified as list or tuple of strings. Any valid Python identifier
+ may be used for a fieldname except for names starting and ending with double
+ underscores.
If *verbose* is true, will print the class definition.