Lisp mentality vs. Python mentality

Paul Rubin http
Sun Apr 26 04:03:15 EDT 2009


namekuseijin <namekuseijin.nospam at gmail.com> writes:
> ...     return (len(a) == len(b)) and not any(not comp(a,b) for (a,b)
> in (zip(a, b)))

If I'm reading that correctly, I think I'd write it as:
   
     from itertools import imap, izip
     return (len(a) == len(b)) and all(imap(comp, izip(a, b)))

That is more concise and avoids building an intermediate list with zip.

Maybe we need something like zipWith ...



More information about the Python-list mailing list