[Python-ideas] CSV api with conversion

Bruce Leban bruce at leapyear.org
Thu Apr 15 00:24:46 CEST 2010


If you do this, you'll probably want to support mapping empty values. That
is,

[int,str]

could map

1,
,2

to

[1,None]
[None,'2']

or

[1,'']
[0,'2']

I'm not sure what the defaults should be but there are reasonable use cases
for both.

--- Bruce
http://www.vroospeak.com


On Mon, Apr 12, 2010 at 3:24 AM, Éric Araujo <merwok at netwok.org> wrote:

> Hello list
>
> This API would be very useful. (I’m using Python right know to filter
> hundreds of spreadsheets records. Loving it.)
>
> Suggestions:
> 1) Name the argument “converters” (it’s an iterable);
> 2) Make it a positional argument.
>
> Related wish: Add an argument for a row factory. Default would be list, and
> use cases include using tuple, a named tuple class, or any custom callable.
>
> Adding converters and rowfactory would remove the need for looping over CSV
> reader objects and manually using row and cell converters.
>
> Cheers
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20100414/90edf237/attachment.html>


More information about the Python-ideas mailing list