Any, All predicates (and vector operations for free)

Christos TZOTZIOY Georgiou DLNXPEGFQVEB at spammotel.com
Mon Feb 17 05:29:33 EST 2003


On Sun, 16 Feb 2003 17:06:15 +0100, rumours say that Alex Martelli
<aleaxit at yahoo.com> might have written:

>But what you need here is a simple loop -- no generators
>needed, really.

Using generators and the new module, itertools, was the fastest version
I could finally do.  Search for "predicates" in the Vaults (when they
get updated), at the end of the tests I included some benchmarking code.
Using All starts off at about 40% more time than doing everything
in-place, and it gets worse as expressions get complex; however, it's
fun, and when you don't care much for the utmost speed, I believe it can
be didactical (at least for newbies :)

Cheers, Python lovers!
-- 
TZOTZIOY, I speak England very best,
Real email address: 'dHpvdEBzaWwtdGVjLmdy\n'.decode('base64')




More information about the Python-list mailing list