[Python-ideas] csv.DictReader could handle headers more intelligently.

MRAB python at mrabarnett.plus.com
Mon Jan 28 18:26:31 CET 2013


On 2013-01-28 15:53, Ethan Furman wrote:
> On 01/28/2013 04:21 AM, Mark Hackett wrote:
>> On Friday 25 Jan 2013, Ethan Furman wrote:
>>> We're going to have to agree to disagree on this point -- I think there
>>> is a huge difference between reassigning a variable which is completely
>>> under your control from losing entire columns of data from a file which
>>> you may have never seen before.
>>>
>>
>> But if you've never seen it before, how do you know that you're going to get a
>> LIST in one column?
>
> I don't, which is why an exception should be raised.
>
+1

It shouldn't silently drop the columns, nor should it silently merge
the columns into a list. It should complain, unless you state that it
should merge if necessary because, presumably, you're prepared for such
an eventuality.




More information about the Python-ideas mailing list