[Csv] Re: First Cut at CSV PEP

Dave Cole djc at object-craft.com.au
Fri Jan 31 01:04:24 CET 2003


>>>>> "Skip" == Skip Montanaro <skip at pobox.com> writes:

Dave> Now without the implicit __str__ and conversion of None to '' we
Dave> would require a shirtload of code to do the same thing, only it
Dave> would be as slow as a slug on valium.

Skip> How about we let the user define how to handle None?  I would
Skip> always want None's appearing in my data to raise and exception.
Skip> You clearly have a use case for automatically mapping to the
Skip> empty string.

I suspect that programs which combine the DB-API and CSV files are
probably quite common.  I agree that the round trip fails, but not all
of those programs need to make the round trip.

What the current behaviour does is "solve" the following:

        DB-API -> CSV 

I think you would find it hard to come up with a meaningful way to
handle NULL columns for any variant of

        CSV -> DB-API

Regardless of the source of the CSV.

The only thing I can think of which makes even partial sense is the
following field translation (for CSV -> DB-API):

        null -> None
        "null" -> "null"

Does that mean that we should have an option on the reader/writer
which provides this functionality?  I don't know.  I would probably
use it if it were there.

- Dave

-- 
http://www.object-craft.com.au



More information about the Csv mailing list