Personally I find lambda x: x to be very readable. It seems quite  close to f(x) = x<div><br clear="all">- John<br>
<br><br><div class="gmail_quote">On Sat, Aug 6, 2011 at 4:50 PM, <a href="mailto:dag.odenhall@gmail.com">dag.odenhall@gmail.com</a> <span dir="ltr"><<a href="mailto:dag.odenhall@gmail.com">dag.odenhall@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Yes, I know, it's merely a (lambda x: x), but I find a need for this<br>
often enough that dedicated, documented function would help<br>
readability and encourage certain patterns. Whether it should go in<br>
builtins or functools is debatable. A name that is neither in conflict<br>
or easily confused with the id() builtin is another problem (the<br>
Haskell identity function is called 'id').<br>
<br>
So what is the use case? A common example is the pattern of "key<br>
functions" as used with sorting: the default is typically the<br>
"identity function". Another example is gettext catalogs, which<br>
effectively are defaultdicts of the identity function.<br>
<br>
<a href="http://en.wikipedia.org/wiki/Identity_function" target="_blank">http://en.wikipedia.org/wiki/Identity_function</a><br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-ideas" target="_blank">http://mail.python.org/mailman/listinfo/python-ideas</a><br>
</blockquote></div><br></div>