[Csv] Request for enhancement for csv
John Machin
sjmachin at lexicon.net
Fri Oct 7 22:54:45 CEST 2005
skip at pobox.com wrote:
> paul> Thats more or less what I do now (but have put the code in the csv
> paul> module so its a one line call).
>
> paul> Do you think it is likely to be worth submitting that as a patch
>
>I'm ambivalent about it. I've never needed that functionality before and
>don't imagine many people will need it. Also, it's not clear to me that the
>KeyError exception raised when there's a mismatch between the expected and
>actual column names is all that much worse than the ValueError I raised in
>my example. There's also the added complexity for the DictReader API. In
>your formulation the fieldnames argument is optional except when strict is
>given.
>
>If it was to go into the module, I'd propose that DictReader be subclassed
>to implement your semantics.
>
>Inputs from the other readers are always welcome as well.
>
>Skip
>
>
>
My take: not in the module. What Paul wants to do is just *one* variant
of column-name checking that I've used or seen in practice. Others: (a)
case insensitive (b) some columns are mandatory, others optional with
default values (c) some mandatory columns, others are "write your own
ticket" columns i.e. the name is not known in advance. The ratio of time
taken to code such stuff in Python to time taken to locate & parse the
docs is too low IMHO.
Cheers,
John
More information about the Csv
mailing list