[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 likely doesn't make sense in any

[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 minimal alternative to writing

[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 Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

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

2012-03-22 Thread R. David Murray
R. David Murray 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 zero impact on perform

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

2012-03-22 Thread Miki Tebeka
Miki Tebeka added the comment: python-ideas post at https://groups.google.com/d/msg/python-ideas/lc_hkpKNvAg/ledftgY0mFUJ -- ___ Python tracker ___

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

2012-03-21 Thread R. David Murray
R. David Murray 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, but in that case you

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

2012-03-21 Thread Miki Tebeka
New submission from Miki Tebeka : 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 in case when item/attr