csv documentation error? (was Re: csv - howto specify fmtparam parameters)

Raymond Hettinger vze4rx4y at verizon.net
Thu Aug 21 14:18:15 CEST 2003


"Peter Otten" <__peter__ at web.de> wrote in message
news:bi26pd$dug$07$1 at news.t-online.com...
> Helmut Jarausch wrote:
>
> > still I am curious: is the documentation in error?
>
> Taken directly from csv.py:
>
> class DictReader:
>     def __init__(self, f, fieldnames, restkey=None, restval=None,
>                  dialect="excel", *args):
>         self.fieldnames = fieldnames    # list of keys for the dict
>         self.restkey = restkey          # key to catch long rows
>         self.restval = restval          # default value for short rows
>         self.reader = reader(f, dialect, *args)
>
> As there is no provision for keyword arguments in DictReader.__init__() as
> opposed to reader, it seems to be a bug that can be easily fixed:
>
> class DictReader:
>     def __init__(self, f, fieldnames, restkey=None, restval=None,
>                  dialect="excel", *args, **kwd):
>         self.fieldnames = fieldnames    # list of keys for the dict
>         self.restkey = restkey          # key to catch long rows
>         self.restval = restval          # default value for short rows
>         self.reader = reader(f, dialect, *args, **kwd)

Please file a bug report so this doesn't get lost.


Raymond Hettinger






More information about the Python-list mailing list