[Python-ideas] csv.DictReader could handle headers more intelligently.
Shane Green
shane at umbrellacode.com
Tue Jan 29 14:45:25 CET 2013
On Jan 29, 2013, at 5:10 AM, Mark Hackett <mark.hackett at metoffice.gov.uk> wrote:
> On Tuesday 29 Jan 2013, you wrote:
>> 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.
>>
>
> Then lets not use a dictionary. And leave the DictReader alone.
>
Yes, I think a more useful CSV construct would map header names to lists of values, provide access to original header and value sequences, and methods for iterating sequential (header,value) items (with possibly repeating header values, and which could be fed to dict() to produce exactly what DictReader produces), As such, it would not be a DictReader because it would produce something that just extended the dictionary API. I would think something like CSVRecord, or just Record, would be more accurate.
More information about the Python-ideas
mailing list