[CSV] Re: First Cut at CSV PEP

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


>>>>> "Andrew" == Andrew McNamara <andrewm at object-craft.com.au> writes:

>> I think it is important to keep in mind the users of the module who
>> are not expert in the various dialects of CSV.  If presented with a
>> flat list of all options supported they are going to engage in a
>> fair amount of head scratching.
>> 
>> If we try to make things easier for users by mirroring the options
>> that their application presents then they are going to have a much
>> easier time working out how to use the module for their specific
>> problem.  By limiting the available options based upon the dialect
>> specified by the user we will be doing them a favour.
>> 
>> The point of the 'raw' dialect is to expose the full capabilities
>> of the raw parser.  Maybe we should use None rather than 'raw'.

Andrew> My feeling is that this simply changes the shape of the
Andrew> complexity without really helping.

Andrew> I think we should just stick with the "a dialect is a set of
Andrew> defaults" idea.

Fair enough.

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'?

Andrew> When saving, Excel97 calls this "Text (Tab delimited)", so
Andrew> maybe "excel-tab" would be clear enough. CSV is "CSV (Comma
Andrew> delimited)".

Yup.

Andrew> On import, it seems to just guess what the file is - I
Andrew> couldn't see a way under Excel97 to specify.

Some kind of sniffing going on.

Should we have a sniffer in the module?

>> I am not saying that the wrapper should absolutely prevent someone
>> from using options not available in the application.  If you want
>> to break the dialect then maybe it should be a two step process.
>> 
>> csvwriter = csv.writer(file("newnastiness.csv", "w"), dialect='excel2000')
>> csvwriter.setparams(delimiter='"')

Andrew> This strikes me as B&D.

Just what are you trying to imply by that? :-)

- Dave

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




More information about the Csv mailing list