Sitelet https://github.com/python/cpython/commit/631ada842454dbb18beb8d3677bd37569be153c8
Skip to content

Commit 631ada8

Browse files
committed
Issue #16026: Fix parameter names of DictReader and DictWriter
CPython and PyPy use f as the name of the first parameter of DictReader and DictWriter classes. Patch by James Salt and Greg Bengeult.
1 parent ff558f5 commit 631ada8

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎Doc/library/csv.rst‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,15 @@ The :mod:`csv` module defines the following functions:
146146

147147
The :mod:`csv` module defines the following classes:
148148

149-
.. class:: DictReader(csvfile, fieldnames=None, restkey=None, restval=None, \
149+
.. class:: DictReader(f, fieldnames=None, restkey=None, restval=None, \
150150
dialect='excel', *args, **kwds)
151151
152152
Create an object that operates like a regular reader but maps the
153153
information in each row to an :mod:`OrderedDict <collections.OrderedDict>`
154154
whose keys are given by the optional *fieldnames* parameter.
155155

156156
The *fieldnames* parameter is a :term:`sequence`. If *fieldnames* is
157-
omitted, the values in the first row of the *csvfile* will be used as the
157+
omitted, the values in the first row of file *f* will be used as the
158158
fieldnames. Regardless of how the fieldnames are determined, the ordered
159159
dictionary preserves their original ordering.
160160

@@ -184,14 +184,14 @@ The :mod:`csv` module defines the following classes:
184184
OrderedDict([('first_name', 'John'), ('last_name', 'Cleese')])
185185

186186

187-
.. class:: DictWriter(csvfile, fieldnames, restval='', extrasaction='raise', \
187+
.. class:: DictWriter(f, fieldnames, restval='', extrasaction='raise', \
188188
dialect='excel', *args, **kwds)
189189
190190
Create an object which operates like a regular writer but maps dictionaries
191191
onto output rows. The *fieldnames* parameter is a :mod:`sequence
192192
<collections.abc>` of keys that identify the order in which values in the
193-
dictionary passed to the :meth:`writerow` method are written to the
194-
*csvfile*. The optional *restval* parameter specifies the value to be
193+
dictionary passed to the :meth:`writerow` method are written to file
194+
*f*. The optional *restval* parameter specifies the value to be
195195
written if the dictionary is missing a key in *fieldnames*. If the
196196
dictionary passed to the :meth:`writerow` method contains a key not found in
197197
*fieldnames*, the optional *extrasaction* parameter indicates what action to
@@ -205,7 +205,7 @@ The :mod:`csv` module defines the following classes:
205205
Note that unlike the :class:`DictReader` class, the *fieldnames* parameter
206206
of the :class:`DictWriter` is not optional. Since Python's :class:`dict`
207207
objects are not ordered, there is not enough information available to deduce
208-
the order in which the row should be written to the *csvfile*.
208+
the order in which the row should be written to file *f*.
209209

210210
A short usage example::
211211

0 commit comments

Comments
 (0)