[New-bugs-announce] [issue40013] CSV DictReader parameter documentation

Moshe Sambol report at bugs.python.org
Thu Mar 19 06:37:30 EDT 2020


New submission from Moshe Sambol <moshe.sambol at gmail.com>:

The csv.DictReader constructor takes two optional parameters, restkey and restval. restkey is documented well, but restval is not:

"If a row has more fields than fieldnames, the remaining data is put in a list and stored with the fieldname specified by restkey (which defaults to None). If a non-blank row has fewer fields than fieldnames, the missing values are filled-in with None."

Since restval is not mentioned here, the reader may assume that the next sentence applies to it:

"All other optional or keyword arguments are passed to the underlying reader instance."

But this is not the case for restval.

I suggest that the text be amended to 

"If a non-blank row has fewer fields than fieldnames, the missing values are filled-in with the value of restval (which defaults to None)."

----------
assignee: docs at python
components: Documentation
messages: 364598
nosy: Moshe Sambol, docs at python
priority: normal
severity: normal
status: open
title: CSV DictReader parameter documentation
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40013>
_______________________________________


More information about the New-bugs-announce mailing list