I have it:
>>> a = lambda : lambda x : x * x
This gives me a permanent address every time:
>>> a <function <lambda> at 0x7f22769e76e0> >>> a <function <lambda> at 0x7f22769e76e0> >>> a <function <lambda> at 0x7f22769e76e0>
However, it is not. Why is that? Also note that it gives only two addresses? Why is that? Is the internal lambda function created on the fly and is returned every time a() called? Wasn't it created when it was announced?
>>> a() <function <lambda> at 0x7f22769e7320> >>> a() <function <lambda> at 0x7f22769e75f0> >>> a() <function <lambda> at 0x7f22769e7320> >>> a() <function <lambda> at 0x7f22769e75f0>
source share