]> granicus.if.org Git - python/commitdiff
bpo-28851: Improve namedtuple documentation (GH-1274)
authorcsabella <chekat2@gmail.com>
Tue, 25 Apr 2017 16:14:45 +0000 (12:14 -0400)
committerMariatta <Mariatta@users.noreply.github.com>
Tue, 25 Apr 2017 16:14:45 +0000 (09:14 -0700)
Clarify that a sequence of strings is the preferred value for 'field_names'.

Doc/library/collections.rst

index 8e2eb4d9b0382f4d91b0047bed7f8d4dd8ffbb3f..2d51f0cfdc094dc3ce8166045632ed28d825c76c 100644 (file)
@@ -771,9 +771,9 @@ they add the ability to access fields by name instead of position index.
     helpful docstring (with typename and field_names) and a helpful :meth:`__repr__`
     method which lists the tuple contents in a ``name=value`` format.
 
-    The *field_names* are a single string with each fieldname separated by whitespace
-    and/or commas, for example ``'x y'`` or ``'x, y'``.  Alternatively, *field_names*
-    can be a sequence of strings such as ``['x', 'y']``.
+    The *field_names* are a sequence of strings such as ``['x', 'y']``.
+    Alternatively, *field_names* can be a single string with each fieldname
+    separated by whitespace and/or commas, for example ``'x y'`` or ``'x, y'``.
 
     Any valid Python identifier may be used for a fieldname except for names
     starting with an underscore.  Valid identifiers consist of letters, digits,