[CSV] Re: First Cut at CSV PEP
Cliff Wells
LogiplexSoftware at earthlink.net
Wed Jan 29 01:28:46 CET 2003
On Tue, 2003-01-28 at 16:15, Dave Cole wrote:
> >>>>> "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.
Whew.
>
> 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'?
So are we leaning towards dialects being done as simple classes? Will
'excel-tsv' simply be defined as
class excel_tsv(excel_2000):
delimiter = '\t'
with a dictionary for lookup:
settings = { 'excel-tsv': excel_tsv,
'excel-2000': excel_2000, }
?
> 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?
This hasn't been brought up, but of course one of the major selling
points of DSV is the "sniffing" code. However, I think I'm with Dave on
having another layer (CSVutils) that would contain this sort of thing.
> >> 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? :-)
We should probably leave people's personal issues out of this ;)
--
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308 (800) 735-0555 x308
More information about the Csv
mailing list