[Csv] Sniffer empty delimiter

skip at pobox.com skip at pobox.com
Thu Dec 29 14:32:47 CET 2005


    John> Contrary to your recollection, I am *not* the author of any part
    John> of the csv module.

Ah, sorry about that.  I'm not the sniffer's author (never used it in fact).

    John> Optional default arg *plus* an exception? Holy redundancy, Batman!

Well, yeah, it's an either/or sort of thing.  I was thinking out loud.

    John> Caller can do this:

    John> try:
    John>      d = csv.Sniffer().sniff(sample)
    John> except csv.Error:
    John>      d = my_default_dialect

Yeah, but today that code would be written

    d = csv.Sniffer().sniff(sample)
    try:
        rdr = csv.reader(f, d)
    except TypeError:
        blah blah blah

so there's a backwards compatibility problem since the exception is raised
by the reader class, not the sniffer.

    John> (3) Some documentation on how the 2nd arg is used would be a good
    John> idea, as would be an explanation of the relationship with the
    John> undocumented "preferred" attribute:
    >> 
    >> Agreed.  I seem to recall you're the author.  Got some text? <wink>

    John> Not so. In fact I'd not even used the sniffer before today.

Unfortunately, neither have I.

    John> Maybe it's even not too late get some feedback from the actual
    John> users and to spec out the sniffer a bit more rigorously and then
    John> ensure it meets that spec.

That sounds good as well.  If the API is going to change, might as well
change it in a useful, non-speculative direction.

Skip




More information about the Csv mailing list