PEP 305 - CSV File API

Skip Montanaro skip at pobox.com
Tue Feb 4 08:25:24 EST 2003


    Ian> Or it could try to convert everything, and those that fail get left
    Ian> as strings.

I think that would be a disaster.  What if data in one column consisted of
hex numbers?  Some would be evaluated as numbers, others left as strings.
The programmer would have to defend against that.

The only way I see to reliably ask the csv module to convert data is to
provide a list of type converters which take a single string as an argument.
There are performance implications of this approach, so it can't be the
default.  One reason I've used Object Craft's csv module up to now is that
it's written in C and is at minimum 5-10x faster than the other options
available.  I routinely read and write 5-10MB CSV files, so I'm sensitive to
performance degradation.

Skip






More information about the Python-list mailing list