[Greg Ward] > Hmmm, a random idea: has filter() ever been used for anything else? > I didn't think so. So why not remove everything *except* that handy > special-case: ie. in 3.0, filter(seq) == filter(None, seq) today, and > that's *all* filter() does. > > Just a random thought... It's been used for lots of other stuff, but I'm not sure if any other use wouldn't read better as a listcomp. For example, from spambayes: def textparts(msg): """Return a set of all msg parts with content maintype 'text'.""" return Set(filter(lambda part: part.get_content_maintype() == 'text', msg.walk())) I think that reads better as: return Set([part for part in msg.walk() if part.get_content_maintype() == 'text']) In Python 3.0 that will become a set comprehension <wink>: return {part for part in msg.walk() if part.get_content_maintype() == 'text'}
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