[Python-ideas] csv.DictReader could handle headers more intelligently.
Shane Green
shane at umbrellacode.com
Tue Jan 29 12:54:09 CET 2013
> And funky CSV formats don't make the current version not work for anyone. It
> works for the people it's been working for all along. Why stop that?
Agreed: I'm actually not for changing the existing stuff. I don't think something that used to return single values, should start returning lists, and if it's going to start raising exceptions, I think that should be an option you enable explicitly. I think maybe this should be deprecated, in favor something that implements what we're discussing. I'm also realizing that way of thinking means it's slightly off topic, and apologize for that ;-)
Shane Green
www.umbrellacode.com
408-692-4666 | shane at umbrellacode.com
On Jan 29, 2013, at 3:39 AM, Mark Hackett <mark.hackett at metoffice.gov.uk> wrote:
> On Tuesday 29 Jan 2013, Alexandre Zani wrote:
>>
>> As for a MultiDictReader, I don't think this is superior to csv.reader. In
>> both cases, you need to keep track of the column orders. And if you already
>> know the column order, you might as well just manually specify the field
>> names in DictReader.
>>
>
> But it would allow you to access the index by name.
>
> value=csv_array[indecies{"Total Cost"}]
>
> A little more verbose than
>
> value=csv_dict{"Total Cost"}
>
> But it's easier to read what it's doing than
>
> value=csv_array[3]
> _______________________________________________
> 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/20130129/a371dff3/attachment.html>
More information about the Python-ideas
mailing list