identity = lambda x: x -- a Pythonic idiom?

Andrew Dalke dalke at
Sat Nov 17 17:48:24 CET 2001

George Demmy:
>identity = lambda x: x # like this in practice (lazy)
>def identity(x): # Pythonic -- shows up in profiler, etc
>    return x
>data = filter(identity, crufty_list)

Isn't this the same as operator.truth?

                    dalke at

More information about the Python-list mailing list