[issue4124] Patch for adding "default" to itemgetter and attrgetter

2009-04-01 Thread Raymond Hettinger
Raymond Hettinger added the comment: Am closing this one because the API doesn't mesh well with the existing extensions for multiple attributes. If those weren't already present, there might be a case for adding this extension. -- resolution: -> rejected status: open -> closed __

[issue4124] Patch for adding "default" to itemgetter and attrgetter

2009-02-04 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- priority: -> low ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.

[issue4124] Patch for adding "default" to itemgetter and attrgetter

2009-02-03 Thread Miki Tebeka
Miki Tebeka added the comment: Can't we find a faster dog for lambda :) Anyway, I agree that we need to see more demand for that before going on. Let's keep this ticket open and see if someone else comes along. ___ Python tracker

[issue4124] Patch for adding "default" to itemgetter and attrgetter

2009-02-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: That makes sense. You've found two object models that have optional attributes and have had some need to extract them with a default. My remaining concern is about adding complexity for functionality that is not often needed. It wouldn't be an issue if ite

[issue4124] Patch for adding "default" to itemgetter and attrgetter

2009-02-02 Thread Miki Tebeka
Miki Tebeka added the comment: Hmmm, too much time has passed and my 1bit memory has overflowed since :) IIRC it has to do with the fact that not all nodes in BeautifulSoup has a "name" attribute. I wanted to count how may "tr" there were, so len(filter(lambda n: n == "tr", map(attrgetter("

[issue4124] Patch for adding "default" to itemgetter and attrgetter

2009-01-30 Thread Raymond Hettinger
Raymond Hettinger added the comment: Am curious about your use cases. ISTM that in every case I've every used either function, I've always known that the attribute or item is going to be there. For instance, the original motivating use cases were to support the key= argument to min/max/sorted/

[issue4124] Patch for adding "default" to itemgetter and attrgetter

2009-01-30 Thread Raymond Hettinger
Raymond Hettinger added the comment: Will take a look at it next week. -- assignee: -> rhettinger nosy: +rhettinger type: -> feature request ___ Python tracker ___

[issue4124] Patch for adding "default" to itemgetter and attrgetter

2008-10-14 Thread Miki Tebeka
New submission from Miki Tebeka <[EMAIL PROTECTED]>: This is a patch for adding "default" keyword to itemgetter and attrgetter. This way you can do: >>> f = itemgetter(0, default=1) >>> f([]) 1 >>> f= attrgetter("a", default="b") >>> f(object()) 'b' >>> I'm not sure about all the Py_INCREF I've