[Python-Dev] Efficient predicates for the standard library

Christian Stork cstork at ics.uci.edu
Mon Oct 6 07:44:28 EDT 2003


On Mon, Oct 06, 2003 at 12:19:54PM +0100, Gareth McCaughan wrote:
...
>     def any(pred, *iterables):
> 
> I think the ability to work with multiple sequences (and
> not to have to use the argument order iter1, pred, iter2, ...)
> is more important than the ability to avoid typing "bool,".

Raymond would tell you to use either chain() or izip() on your
*iterables.  ;-)  This would also make clear what is actually meant.

> Another option would be
> 
>     def any(*iterables, pred=bool):

>>> def any(*iterables, pred=bool):
------------------------------------------------------------
   File "<stdin>", line 1
     def any(*iterables, pred=bool):
                            ^
SyntaxError: invalid syntax


-Chris



More information about the Python-Dev mailing list