Favorite non-python language trick?
Konstantin Veretennicov
kveretennicov at gmail.com
Sun Jun 26 05:59:09 EDT 2005
On 25 Jun 2005 12:17:20 -0700, George Sakkis <gsakkis at rutgers.edu> wrote:
> If they go to itertools, they can simply be:
>
> def map(f, *iterables):
> return list(imap(f,*iterables))
>
> def filter(f, seq):
> return list(ifilter(f,seq))
>>> from itertools import ifilter
>>> def filter(f, seq):
... return list(ifilter(f,seq))
>>> filter(str.isalpha, 'not quite!')
['n', 'o', 't', 'q', 'u', 'i', 't', 'e']
>>> __builtins__.filter(str.isalpha, 'not quite!')
'notquite'
- kv
More information about the Python-list
mailing list