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

Mark Hackett mark.hackett at metoffice.gov.uk
Thu Jan 24 16:29:19 CET 2013


On Thursday 24 Jan 2013, J. Cliff Dyer wrote:
> > > 2. Give an error when encountering a duplicate field name (which 
> > > will lead to data loss when reading from the file) (consensus seems
> > > to be "yes") 
> 
> Mostly, but with a strong objection from Mark Hackett, and hesitation
> about altering current behavior from Amaury Forgeot d'Arc.
> 


More along the lines of your earlier:

> 1. It's a backwards-incompatible change.

strong objection. :-)

Programs that had been working will stop. Programs that won't work because it 
doesn't throw an exception yet are no worse off.

When you change something, you'll hear almost entirely from those for whom the 
change will be useful. From those who will find it an obstacle, you don't hear 
from. Until it's implemented.

Requiring catching an exception means that until the code is changed, your 
working program no longer works.

And as you later point out Cliff, empty and uninteresting field names may 
legitimately exist and WANT to be ignored.

So although I CAN see a reasoning for an exception, I do not see it as enough 
to put it in this version of the library. It's a learning process and for the 
next version which will need code changes to incorporate anyway, that 
knowledge can be used to make things better *next time*.



More information about the Python-ideas mailing list