This simple Python code gets "False".
def foo():
def bar():
return 0
return bar
print(foo() == foo())
When I request
print(foo(),foo())
I get
<function foo.<locals>.bar at 0x03A0BC40> <function foo.<locals>.bar at 0x03C850B8>
So does Python store the result of the bar function every time in the new memory slot? I'd be happy if someone explain how it works behind the scene and possibly how this code can be a little bit modified to get "True" (which still seems logical to me!).