[Python-ideas] csv.DictReader could handle headers more intelligently.
Shane Green
shane at umbrellacode.com
Tue Jan 29 14:08:25 CET 2013
Let's remove the assumptions about their information by retaining all of it, and make an assumption that everyone is capable of dealing with lists.
Shane Green
www.umbrellacode.com
408-692-4666 | shane at umbrellacode.com
On Jan 29, 2013, at 4:35 AM, Mark Hackett <mark.hackett at metoffice.gov.uk> wrote:
> On Tuesday 29 Jan 2013, Steven D'Aprano wrote:
>>> If it dropped the columns and shouldn't have, then the results will be
>>> seen to be wrong anyway, so there's not a huge amount of need for this.
>>
>> You cannot assume that the caller knows that there are duplicated column
>> names
>>
>
> You cannot assume they wanted them as a list.
>
> You cannot assume that duplicate replacement is what they want.
>
> If someone is using a csv file with header names they have never read, how are
> they going to use the data? They won't even know the name to access the value
> in the dictionary! So I discard the claim that the caller may not know the
> column names are duplicated. They have to know what the headers are to use
> DictReader.
> _______________________________________________
> 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/0ef9537a/attachment.html>
More information about the Python-ideas
mailing list