I see that Python 2.5 will include a simple implementation of any/all. What I would like to ask, before it's too late, is if it's possible to add an optional test argument.
any(iterable, test=bool) and all(iterable, test=bool) These would be the new proposed APIs. The usecase is to be able to extract attributes from objects or simply to have arbitrary checks like: import operator any(some_objects, test=operator.attrgetter('some_attribute')) or def zerop(x): return x==0 all(some_objects, zerop) instead of preprocessing the generator with a generator expression before passing it to any/all. Thanks. -- Valentino Volonghi aka Dialtone Now Running MacOSX 10.4 Blog: http://vvolonghi.blogspot.com http://weever.berlios.de
pgpm3YZZLyclq.pgp
Description: PGP signature
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com