[CSV] Re: First Cut at CSV PEP

Dave Cole djc at object-craft.com.au
Wed Jan 29 04:25:16 CET 2003


>>>>> "Skip" == Skip Montanaro <skip at pobox.com> writes:

Skip> Dunno who said this now, but I disagree with this statement:

>>> I suppose that exporting should raise an exception if you specify
>>> any variation on the dialect in the writer function.

That was me.  I now agree that it is a bad idea.  Andrew suggested
that we apply the KISS principle.  I agree with his suggestion that a
dialect just defines a collection of settings in the parser.  You are
then free to redefine any or all of those settings as additional
keyword arguments to the csv.reader() or csv.writer() functions.

Skip> In the proto-PEP I tried to address this issue:

Skip>     When processing a dialect setting and one or more of the
Skip> other optional parameters, the dialect parameter is processed
Skip> first, then the others are processed.  This makes it easy to
Skip> choose a dialect, then override one or more of the settings.
Skip> For example, if a CSV file was generated by Excel 2000 using
Skip> single quotes as the quote character and TAB as the delimiter,
Skip> you could create a reader like::

Skip>   csvreader = csv.reader(file("some.csv"),
Skip>                          dialect="excel2000", quotechar="'",
Skip>                          delimiter='\t')

I think that we now in violent agreement.  A good thing.

- Dave

-- 
http://www.object-craft.com.au

_______________________________________________
Csv mailing list
Csv at mail.mojam.com
http://manatee.mojam.com/mailman/listinfo/csv



More information about the Csv mailing list