efficient list reduction

Paul Rubin http
Tue May 11 04:03:34 EDT 2004


gnosticray at aol.com (A B Carter) writes:
> [oldlist[key] for key in keys]
> 
> Have I missed something?

If the keys and values are all characters or small positive ints,
maybe you can contort your program to let you use the very fast
string.translate operation.  Otherwise, use psyco, and if your
listcomp is still not fast enough, write a C extension.



More information about the Python-list mailing list