[Python-ideas] [offlist] Re: Add "default" kw argument to operator.itemgetter and operator.attrgetter
raymond.hettinger at gmail.com
Thu May 3 16:26:23 EDT 2018
> On May 2, 2018, at 11:32 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> Intended by whom?
By me. I proposed itemgetter() in the first place. That rationale I gave convinced Guido and python-dev to accept it. I then wrote the code, docs, tests and have maintained it for over a decade. So, I have a pretty good idea of what it was intended for.
> I think you are being too dismissive of actual use-cases requested by
> actual users.
Wow, I don't know what to do with this. Over the years, I've added a lot of things requested by users. I really don't like the tone you've struck and what you've implied about me as developer. That feels somewhat pushy and aggressive. Why not just give a +1 to things that are a good idea and -1 for things we're better off without -- no need for ad hominem comments about the person making the post rather than its content -- that feels somewhat disrespectful.
> Default values might not have been the primary use
> considered when the API was first invented, but the fact that people
> keep asking for this feature should tell us that at least some people
> have intended uses that are remaining unmet.
When I've seen the request in the past, it always alway "it might be nice if ..." but there were no legitimate use cases presented, just toy examples. Also, I'm concerned that about increasing the complexity of itemgetter() API to serve an occasional exotic use case rather that being easy to learn and remember for the common cases.
More information about the Python-ideas