Author rrenaud
Recipients barry, jdwhitley, rhettinger, rrenaud, skip.montanaro
Date 2009-02-27.02:16:54
SpamBayes Score 4.91543e-07
Marked as misclassified No
Message-id <855a6b050902261816w62e408a8saf4b30c20947cb94@mail.gmail.com>
In-reply-to <18855.15136.535327.807594@montanaro.dyndns.org>
Content
I did a search on Google code for the DictReader constructor.  I
analyzed the first 3 pages, the fieldnames parameter was used in 14 of
27 cases (discounting unittest code built into Python) and was not
used in 13 of 27 cases.  I suppose that means headered csv files are
sufficiently rare that they shouldn't be created implicitly by
default.  I still don't like the lack of symmetry of supporting
implicit header reads, but not implicit header writes.

On Thu, Feb 26, 2009 at 8:00 PM, Skip Montanaro <report@bugs.python.org> wrote:
>
> Skip Montanaro <skip@pobox.com> added the comment:
>
> More concretely, I don't think this is so onerous:
>
>    names = ["col1", "col2", "color"]
>    writer = csv.DictWriter(open("f.csv", "wb"), fieldnames=names, ...)
>    writer.writerow(dict(zip(names, names)))
>    ...
>
> or
>
>    f = open("f.csv", "rb")
>    names = csv.reader(f).next()
>    reader = csv.DictReader(f, fieldnames=names, ...)
>    ...
>
> Skip
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue1818>
> _______________________________________
>
History
Date User Action Args
2009-02-27 02:16:56rrenaudsetrecipients: + rrenaud, skip.montanaro, barry, rhettinger, jdwhitley
2009-02-27 02:16:55rrenaudlinkissue1818 messages
2009-02-27 02:16:54rrenaudcreate