On Fri, Sep 12, 2008 at 4:44 PM, Diez B. Roggisch <[EMAIL PROTECTED]> wrote: >>> if any(instance.forbitToClose(archivefolder) for instance in >>> self.findActiveOutgoingRegistrationInstances()) >> >> Can you clarify where I can find "any"? It seems to me I'm unable to find >> it... > > It's part of python2.5. > > If you don't have that, you can write it your own and stuff it into > __builtins__: > >>>> def any(iterable): > ... for item in iterable: > ... if item: > ... return True > ... return False > ... > ... __builtins__.any = any > > > You might also want to add all, the companion of any: > > >>>> def all(iterable): > ... for item in iterable: > ... if not item: > ... return False > ... return True > ... > > Diez > -- > http://mail.python.org/mailman/listinfo/python-list >
I'm afraid this have another problem for me... [EMAIL PROTECTED]:/var/local/zope28/porting/Products/PAFlow$ python2.3 Python 2.3.5 (#2, Oct 18 2006, 23:04:45) [GCC 4.1.2 20061015 (prerelease) (Debian 4.1.1-16.1)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> def any(iterable): pass ... >>> any(x for x in [1, 2, 3]) File "<stdin>", line 1 any(x for x in [1, 2, 3]) ^ SyntaxError: invalid syntax >>> >>> any([x for x in [1, 2, 3]]) >>> I mean, I'm afraid I can't use an expression like that without building a list... not at least in python2.3 Regards Marco -- Marco Bizzarri http://notenotturne.blogspot.com/ http://iliveinpisa.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list