Skip to content

Commit 84df317

Browse files
authored
gh-113046: Revise csv.reader doc (#113207)
Clarify nature of csvfile.
1 parent 5ae75e1 commit 84df317

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Doc/library/csv.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,11 @@ The :mod:`csv` module defines the following functions:
5555

5656
.. function:: reader(csvfile, dialect='excel', **fmtparams)
5757

58-
Return a reader object which will iterate over lines in the given *csvfile*.
59-
*csvfile* can be any object which supports the :term:`iterator` protocol and returns a
60-
string each time its :meth:`!__next__` method is called --- :term:`file objects
61-
<file object>` and list objects are both suitable. If *csvfile* is a file object,
58+
Return a :ref:`reader object <reader-objects>` that will process
59+
lines from the given *csvfile*. A csvfile must be an iterable of
60+
strings, each in the reader's defined csv format.
61+
A csvfile is most commonly a file-like object or list.
62+
If *csvfile* is a file object,
6263
it should be opened with ``newline=''``. [1]_ An optional
6364
*dialect* parameter can be given which is used to define a set of parameters
6465
specific to a particular CSV dialect. It may be an instance of a subclass of
@@ -449,6 +450,8 @@ Dialects support the following attributes:
449450
When ``True``, raise exception :exc:`Error` on bad CSV input.
450451
The default is ``False``.
451452

453+
.. _reader-objects:
454+
452455
Reader Objects
453456
--------------
454457

0 commit comments

Comments
 (0)