[CSV] Re: First Cut at CSV PEP

Skip Montanaro skip at pobox.com
Wed Jan 29 03:06:55 CET 2003


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.

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

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

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

    Other details of how Excel generates CSV files would be handled
    automatically.

I think we should try our damndest to not raise exceptions.  The
example is just to show that we will allow people to start from a
known state and tweak it.  "This file has all the properties of an
Excel 2000 file except an apostrophe was used as the quote character
and a TAB was used as the delimiter."

Skip



More information about the Csv mailing list