[CSV] Re: First Cut at CSV PEP

Dave Cole djc at object-craft.com.au
Wed Jan 29 01:47:01 CET 2003

>>>>> "Cliff" == Cliff Wells <LogiplexSoftware at earthlink.net> writes:

>>  Instead of limiting the tweakable options by raising an exception
>> we could have an interface which allowed the user to query the
>> options normally associated with a dialect.
>> >> Hmm...  What would be the best way to handle Excel TSV.  Maybe a
>> >> new dialect 'excel-tsv'?

Cliff> So are we leaning towards dialects being done as simple
Cliff> classes?  Will 'excel-tsv' simply be defined as

Cliff> class excel_tsv(excel_2000):
Cliff>    delimiter = '\t'

Cliff> with a dictionary for lookup:

Cliff> settings = { 'excel-tsv': excel_tsv,
Cliff>              'excel-2000': excel_2000,
Cliff> }

Dunno yet.

Here we go again with a potentially bad idea...

I think that there are two things we need to have for each dialect; a
set of low level parser configuration, and a set of user tweakables
(which correspond to options presented by the application).  The set
of user tweakables may not necessarily map one-to-one with low level
parser configuration items.

How would we do this in Python?

>> Should we have a sniffer in the module?

Cliff> This hasn't been brought up, but of course one of the major
Cliff> selling points of DSV is the "sniffing" code.  However, I think
Cliff> I'm with Dave on having another layer (CSVutils) that would
Cliff> contain this sort of thing.

Any sniffer would have to be able to traverse the set of dialects
implemented in the CSV module and look inside them to understand
which options are available to a dialect.

- Dave


More information about the Csv mailing list