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

Andrew Dalke dalke at dalkescientific.com
Sat Nov 17 13:24:55 EST 2001


George Demmy:
>operator.truth and the identity function are not exactly the same.
>operator.truth returns 1 if true, 0 if false. identity returns its
> argument

D'oh!  And duh!

>For filtering purposes, they have the same effect.

I was only thinking about its use in this context, forgetting
the larger sense.

                    Andrew






More information about the Python-list mailing list