[issue32010] Multiple get "itemgetter"

2017-11-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: I also don't think this should be done to itemgetter() which should remain focused on its core task. Thank you for the suggestion, but am marking this as closed. Perhaps consider posting a recipe to the ASPN cookbook (I've

[issue32010] Multiple get "itemgetter"

2017-11-12 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: As you have said, this will break existing code. And this is not applicable to non-string indices. I think that it would be easier to use a lambda or local function for this: `lambda x: x['a']['b']`. It is shorter and cleaner.

[issue32010] Multiple get "itemgetter"

2017-11-12 Thread Mario Corchero
New submission from Mario Corchero : At the moment we can get an operator that performs multiple "gets" in object attributes. Example: >>> getter = operator.attrgetter("child1.child2") >>> o = mock.Mock() >>> getter(o) On the other hand, itemgetter -which can be used for