Steven D'Aprano wrote: > Playing around with comparisons of functions (don't ask), I discovered an > interesting bit of unintuitive behaviour: > >>>>a = lambda y: y >>>>b = lambda y: y >>>>a > <function <lambda> at 0xf70598ec> >>>>b > <function <lambda> at 0xf7059844> >>>>a < b > False > > So I'm puzzled about how Python compares the two.
Seems to me the object addresses are compared in this case. But I'm too lazy to check it in the source. ;) However, the doc [1] warns you about such comparisons: """Most other types compare unequal unless they are the same object; the choice whether one object is considered smaller or larger than another one is made arbitrarily but consistently within one execution of a program.""" [1] http://docs.python.org/ref/comparisons.html -- http://mail.python.org/mailman/listinfo/python-list