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

Mark Hackett mark.hackett at metoffice.gov.uk
Fri Jan 25 17:53:46 CET 2013


On Friday 25 Jan 2013, Ethan Furman wrote:
> On 01/25/2013 03:00 AM, Mark Hackett wrote:
> > On Thursday 24 Jan 2013, Steven D'Aprano wrote:
> >> - it is less obvious: how does the caller decide that there are too many
> >>     field names?
> >
> > Additionally, the user of the library now has to read much more about the
> > library (either code or documentation, which has to track the code too),
> > to decide what it is going to do.
> >
> > If you have to read the code, then it's not really OO, is it. It's light
> > grey, not black box.
> 
> If you have to read the code, the documentation needs improvement.
> 

And if you put your feet too close to the fire, your feet will burn.

Neither have anything to do with the subject at hand, however.

Which is if a dictionary acts a certain way and calling a routine that creates 
a dictionary AND WORKS DIFFERENTLY, then why did you use a routine that 
creates a dictionary?

You see, the option here is to leave it operating as a dictionary operates. 
And in that case, you do not need to document anything. The documentation of 
how it works is already covered by the python basics: "How does a dictionary 
work in Python?".

So don't change it, and you don't have to improve the documentation.



More information about the Python-ideas mailing list