Why is lambda allowed as a key in a dict?

S Arrowsmith sion at paintbox.UUCP
Tue Mar 10 12:34:29 CET 2009

Iain King  <iainking at gmail.com> wrote:
>Sort of tangenitally; is there any real difference between the outcome
>of the two following pieces of code?
>a = lambda x: x+2
>def a(x):
>    return x+2


As for why that matters, try a(None) and see which gives the more
informative traceback.


   under construction

More information about the Python-list mailing list