[Csv] Weird dialects?

Andrew McNamara andrewm at object-craft.com.au
Fri Jan 31 01:25:57 CET 2003


>Andrew> Something that occured to me last night - we might find that
>Andrew> there are strange dialects that we can't easily parse with the
>Andrew> C parser (without make it ugly). It occured to me that maybe
>Andrew> the dialect should contain some sort of specification of the
>Andrew> parser to use. But my feeling is that if it's too hard to
>Andrew> parse with the C parser, it isn't a CSV file, and it should
>Andrew> therefore be someone else's problem. Agreed?
>
>Why not allow the parser factory function to be an optional argument
>to the reader and writer factory functions?
>
>    class csvreader:
>        def __init__(self, fileobj, dialect='excel2000', parser=_csv.parser,
>                     **options):
>            :
>            self.parser = parser(**parser_options)
>
>This would allow pluggable parsers.

Well, that's essentially what I was suggesting, but I suspect it's too
much flexibility - we're not trying to build a general purpose parser
framework. And on further thought, this is something that can be addressed
later, if need be.

-- 
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/


More information about the Csv mailing list