"Martin v. Löwis" writes: > > res.get() would be a fairly obvious way to do it. Enough that I would > > probably never have gone searching for any of the other answers. Though > > personally, I think I would call it "set.peek()", but the specific name > > doesn't really matter to me. > > Somebody proposed to call it .any(); this I like best (except that one > might expect that any takes a predicate as the argument). Why not allow that? def any(self, predicate=lambda x: True, default=None) for a in self: if predicate(a): break else: return default return a
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