[Python-ideas] csv.DictReader could handle headers more intelligently. (original) (raw)
Stephen J. Turnbull stephen at xemacs.org
Tue Jan 29 21:37:38 CET 2013
- Previous message: [Python-ideas] csv.DictReader could handle headers more intelligently.
- Next message: [Python-ideas] csv.DictReader could handle headers more intelligently.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Eric V. Smith writes:
True. But my point stands: it's possible to read the data (even with a DictReader), do something with the data, and not know the column names in advance. It's not an impossible use case.
But it is. Dicts don't guarantee iteration order, so you will most likely get an output file that not only has a different delimiter, but a different order of fields.
The right use case here is duck-typing. Something like "I have a bunch of tables of data about car models from different manufacturers which have different sets of columns, and I know that all of them have a column labeled 'MSRP', but which column might vary across tables."
Of course, I don't actually believe you'd get that lucky.
- Previous message: [Python-ideas] csv.DictReader could handle headers more intelligently.
- Next message: [Python-ideas] csv.DictReader could handle headers more intelligently.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]