AW: [Python-de] Funktionale Denksportaufgabe

Gerson Kurz Gerson.Kurz at t-online.de
Thu Sep 26 20:08:30 EDT 2002


Losung ohne List Comprehension

filter1 = lambda f,s:not f and s or (lambda y=[]:(map(lambda x:f(x) and
(y.append(x),),s),y))()[1]

# test
f = lambda x: not (x % 3)

s = range(10)
print filter1(None,s)
print filter1(f,s)
print s





More information about the Python-de mailing list