(original) (raw)
I'm not sure this is constructive.I think it's safe to assume changing something in an API that used to return single values, into something that now returns lists of those values, will be a problem for folks.
I also think it's safe to assume folks can design their applications for an API that returns lists of values. In support of this assumption, I will point out that's precisely what CGI's FieldStorage does to represent all HTML form values because some form values (radio buttons, checkboxes, etc.), can have more than one value associated with their name on submission.
Finally, I would assert that the more legally formatted content your content reader accurately reads and handles, the better.
On Jan 29, 2013, at 5:44 AM, Mark Hackett <mark.hackett@metoffice.gov.uk> wrote:
On Tuesday 29 Jan 2013, Steven D'Aprano wrote:On 29/01/13 23:35, Mark Hackett wrote:On Tuesday 29 Jan 2013, Steven D'Aprano wrote:If it dropped the columns and shouldn't have, then the results will be
seen to be wrong anyway, so there's not a huge amount of need for this.
You cannot assume that the caller knows that there are duplicated column
names
You cannot assume they wanted them as a list.
I don't need to assume that. They can take the list and post-process it
into any data type they want.
Yes you ARE assuming it. You want them to post process it. But if they don't
know there are duplicates there and have found their script works for their
needs and therefore never looked, they will now get the wrong answer.
As Oscar says, they could process the csv file themselves by hand and code in
EXACTLY what they want. They don't have to put it in a dictionary then.
And you've already saidThen adding to a dictionary was a mistake.
So they shouldn't be using DictReader.
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
Python-ideas mailing list
Python-ideas@python.org
http://mail.python.org/mailman/listinfo/python-ideas