Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 10438:e6dc44147234
util: add any() and all() functions for Python 2.4 compatibility
This patch adds these two very useful functions to the mercurial.util module,
because they are not present in Python 2.4.
author | Steve Losh <steve@stevelosh.com> |
---|---|
date | Fri, 12 Feb 2010 19:59:09 -0500 |
parents | 600142e7a028 |
children | 7a6b5f85c3ab |
comparison
equal
deleted
inserted
replaced
10437:8a99388f87cc | 10438:e6dc44147234 |
---|---|
1340 time.sleep(0.1) | 1340 time.sleep(0.1) |
1341 return pid | 1341 return pid |
1342 finally: | 1342 finally: |
1343 if prevhandler is not None: | 1343 if prevhandler is not None: |
1344 signal.signal(signal.SIGCHLD, prevhandler) | 1344 signal.signal(signal.SIGCHLD, prevhandler) |
1345 | |
1346 def any(iterable): | |
1347 for i in iterable: | |
1348 if i: | |
1349 return True | |
1350 return False | |
1351 | |
1352 def all(iterable): | |
1353 for i in iterable: | |
1354 if not i: | |
1355 return False | |
1356 return True |