[PEP305] Python 2.3: a small change request in CSV module

Bernard Delmée bdelmee at advalvas.REMOVEME.be
Fri May 16 14:35:37 EDT 2003


Hi Skip,

> I'll leave Dave and Andrew to comment on the possibility of admitting a
> multiple-character delimiter string, as that will affect their C code.

Are they monitoring this ng as well, or should I repost elsewhere?
Notice I am not asking for a multichar delimiter but for multiple
alternate single-char separators.

    Bernard>     for fields in csv.reader( infile, dialect='sniff' ):
    Bernard>         # do something with fields

> Do you mean to imply that the csv.reader object should call the sniffer
> implicitly and use the values it returns?  That's an interesting idea but
> the sniffer isn't guaranteed to always guess right.

Yes that's exactly my suggestion. Also, if this was supported directly in
reader(), the file-like argument would not necessarily have to be seekable,
it could conceivably just use the first read data chunk for the guess-work
as well as for further parsing of the first rows.

I hope this could be deemed a common enough usage to grant inclusion in the
standard module.

Thanks,

Bernard.







More information about the Python-list mailing list