##// END OF EJS Templates
util: use the built-in any() and all() methods if they are available
Steve Losh -
r10487:7a6b5f85 stable
parent child Browse files
Show More
@@ -1343,14 +1343,17 b' def rundetached(args, condfn):'
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
1345
1346 def any(iterable):
1346 try:
1347 for i in iterable:
1347 any, all = any, all
1348 if i:
1348 except NameError:
1349 return True
1349 def any(iterable):
1350 return False
1350 for i in iterable:
1351 if i:
1352 return True
1353 return False
1351
1354
1352 def all(iterable):
1355 def all(iterable):
1353 for i in iterable:
1356 for i in iterable:
1354 if not i:
1357 if not i:
1355 return False
1358 return False
1356 return True
1359 return True
General Comments 0
You need to be logged in to leave comments. Login now