[Csv] CSV interface question

Andrew McNamara andrewm at object-craft.com.au
Thu Jan 30 00:43:45 CET 2003

>    Andrew> csv.reader(fileobj, csv.dialect.excel)
>    Andrew> Thoughts?
>    Dave> Is there a downside to this?  I can't see one immediately.
>With the dialect concept all we are talking about is a collection of
>parameter settings.  Encapsulating that as subclasses seems like it hides
>the data-oriented nature behind the facade of source code.

It has the virtue that sub-classing can be used to represent related
variants. So, excel-tab might be:

        class excel-tab(excel):
            delimiter = '\t'

This could also be useful for users of the module:

        class funky(excel):
            quotes = "'"

Essentially we'd be using classes as glorified dictionaries with
cascading values.

Andrew McNamara, Senior Developer, Object Craft
Csv mailing list
Csv at mail.mojam.com

More information about the Csv mailing list