"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 _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com