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

Mark Hackett mark.hackett at metoffice.gov.uk
Wed Jan 23 19:24:07 CET 2013


On Wednesday 23 Jan 2013, J. Cliff Dyer wrote:
>> Whether it's a subclass or a change to the existing class is worth
> having a discussion about. Obviously, the change could be made in a
> subclass. Currently, that's what I do. The question at issue is
> whether it should be made in the original. My position is that
> something should change in the standard library, whether that is
> modifying the code in some way to handle edge cases more robustly, or
> updating the documentation to advise programmers on how to handle files
> that aren't perfectly formed.
>
It looks entirely like a format checking on something that doesn't necessarily 
have a format.
It therefore belongs in something else. I.e. you define your "csv schema", pass 
it on to something that creates a "lint check" on the entire bytestream and/or 
checks each input as read, and passed in like any decoration on a base 
function in python.
CSV format checking isn't, IMO any different than the socket service decorators 
that embed policy on the base function.


More information about the Python-ideas mailing list

AltStyle によって変換されたページ (->オリジナル) /