[issue14384] Add "default" kw argument to operator.itemgetter and operator.attrgetter

2019-08-02 Thread Raymond Hettinger
Raymond Hettinger added the comment: Marking as closed for the reasons listed above. And there has been no further comments for over a year. -- resolution: -> rejected status: open -> closed ___ Python tracker

[issue14384] Add "default" kw argument to operator.itemgetter and operator.attrgetter

2018-05-05 Thread Raymond Hettinger
Raymond Hettinger added the comment: Here are a few more thoughts and a concrete example for clarity. Itemgetter/Attrgetter were designed to make multiple lookups (possibly multi-level) and to return a tuple that need not be homogenous. A single default value

[issue14384] Add "default" kw argument to operator.itemgetter and operator.attrgetter

2018-05-04 Thread Raymond Hettinger
Raymond Hettinger added the comment: FWIW, Joe Jevnik worked hard to squeeze every possible nanosecond out of these calls because they were frequently used. Extending this API will tend to undo his efforts. The original intent of itemgetter() was to provide a

[issue14384] Add "default" kw argument to operator.itemgetter and operator.attrgetter

2018-05-04 Thread Guido van Rossum
Guido van Rossum added the comment: I think represents a legitimate use case. There's another request for this on python-ideas: https://groups.google.com/d/msg/python-ideas/0jeftqQpm9c/yZ_uKO84BAAJ -- nosy: +gvanrossum resolution: later -> status: closed -> open

[issue14384] Add default kw argument to operator.itemgetter and operator.attrgetter

2012-03-22 Thread Miki Tebeka
Miki Tebeka miki.teb...@gmail.com added the comment: python-ideas post at https://groups.google.com/d/msg/python-ideas/lc_hkpKNvAg/ledftgY0mFUJ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14384

[issue14384] Add default kw argument to operator.itemgetter and operator.attrgetter

2012-03-22 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Great. I'm going to close the issue, but it's only for now: if you get a good response and a design agreement on python-ideas please reopen the issue. Of course, we'd need a patch, too; and I believe there would need to be close to

[issue14384] Add default kw argument to operator.itemgetter and operator.attrgetter

2012-03-22 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- assignee: - rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14384 ___ ___

[issue14384] Add default kw argument to operator.itemgetter and operator.attrgetter

2012-03-21 Thread Miki Tebeka
New submission from Miki Tebeka miki.teb...@gmail.com: This way they will behave more like getattr and the dictionary get. If default is not specified, then if the item/attr not found, an execption will be raised, which is the current behavior. However if default is specified, then return it

[issue14384] Add default kw argument to operator.itemgetter and operator.attrgetter

2012-03-21 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Thanks for the suggestion. It is an interesting idea, but there are some issues. attrgetter and itemgetter can take more than one key. It would probably make more sense to have the returned function be the one that takes the default,