> (This thread has nothing to do with the groupby iterator any more, but > I'm loathe to change the subject since so many messages are already > under this one.) > > (I've read quite a few messages posted after Greg's post, but Greg > still summarizes the issue best for me, *and* it has an alternative > idea that needs a response.) I'm am still curious to hear your thoughts on the either sublime or crazy idea for a generalized extractor object: list.sorted(students, key=extract.score) list.sorted(animal_weights, key=extract[1]) groupby(students, key=extract.homeroom) groupby(recordtuples, key=extract[0]) Raymond Hettinger P.S. The implementation code is very simple: class ExtractorClass(object): def __getattribute__(self, attr): return operator.attrgetter(attr) def __getitem__(self, key): return operator.itemgetter(key) extract = ExtractorClass()
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