# HG changeset patch # User Steve Losh # Date 2010-02-16 14:31:35 # Node ID 7a6b5f85c3ab9561a447bb02ada7eda53263cb94 # Parent 6b354a76361784e566436b497a0b0583066a4304 util: use the built-in any() and all() methods if they are available diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -1343,14 +1343,17 @@ def rundetached(args, condfn): if prevhandler is not None: signal.signal(signal.SIGCHLD, prevhandler) -def any(iterable): - for i in iterable: - if i: - return True - return False +try: + any, all = any, all +except NameError: + def any(iterable): + for i in iterable: + if i: + return True + return False -def all(iterable): - for i in iterable: - if not i: - return False - return True + def all(iterable): + for i in iterable: + if not i: + return False + return True