New submission from Moshe Sambol <moshe.sam...@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@python
components: Documentation
messages: 364598
nosy: Moshe Sambol, docs@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue40013>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to