On Fri, 11 Mar 2005 19:48:45 +0100, Alex Martelli <aleaxit at yahoo.com> wrote: > Which reminds me -- could we have a methodcaller relative to attrgetter > and itemgetter? "Sort a list of strings in a case-insensitive way" > would become *SO* easy with sort(dalist, key=methodcaller('lower'))... > can't REALLY recommend sort(dalist, key=str.lower) then the items of > dalist MIGHT be either str or unicode items... I'd like to second this suggestion -- I've run into this problem a few times. When you're using a listcomp or genexp, you can inline it of course, but especially with a lot of functions growing the incredibly convenient key= arguments in 2.5 (e.g. min, max and the deque functions if I recall correctly), methodcaller would be a much more duck-typing friendly way to create such callables. Steve -- You can wordify anything if you just verb it. --- Bucky Katt, Get Fuzzy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4