Skip to content

Commit 97bf722

Browse files
csabellaMariatta
authored andcommitted
bpo-28851: Improve namedtuple documentation (pythonGH-1274)
Clarify that a sequence of strings is the preferred value for 'field_names'.
1 parent 3e2ad8e commit 97bf722

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Doc/library/collections.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -771,9 +771,9 @@ they add the ability to access fields by name instead of position index.
771771
helpful docstring (with typename and field_names) and a helpful :meth:`__repr__`
772772
method which lists the tuple contents in a ``name=value`` format.
773773

774-
The *field_names* are a single string with each fieldname separated by whitespace
775-
and/or commas, for example ``'x y'`` or ``'x, y'``. Alternatively, *field_names*
776-
can be a sequence of strings such as ``['x', 'y']``.
774+
The *field_names* are a sequence of strings such as ``['x', 'y']``.
775+
Alternatively, *field_names* can be a single string with each fieldname
776+
separated by whitespace and/or commas, for example ``'x y'`` or ``'x, y'``.
777777

778778
Any valid Python identifier may be used for a fieldname except for names
779779
starting with an underscore. Valid identifiers consist of letters, digits,

0 commit comments

Comments
 (0)