introduce py.builtin.any

--HG--
branch : trunk
This commit is contained in:
holger krekel
2010-10-05 17:21:27 +02:00
parent 6892dc47a3
commit a054b63bac
4 changed files with 15 additions and 0 deletions

View File

@@ -102,6 +102,7 @@ py.apipkg.initpkg(__name__, dict(
'enumerate' : '._builtin:enumerate',
'reversed' : '._builtin:reversed',
'sorted' : '._builtin:sorted',
'any' : '._builtin:any',
'set' : '._builtin:set',
'frozenset' : '._builtin:frozenset',
'BaseException' : '._builtin:BaseException',

View File

@@ -35,6 +35,15 @@ except NameError:
def __length_hint__(self):
return self.remaining
try:
any = any
except NameError:
def any(iterable):
for x in iterable:
if x:
return True
return False
try:
sorted = sorted
except NameError: