Why doesn't __call__ lead to infinite recursion?

Patrick Lioi patrick at novaroot.com
Fri Aug 15 15:58:55 EDT 2003


def foo(): pass

foo is a function
foo is a callable object
foo has method __call__ defined

foo.__call__ is a function
foo.__call__ is a callable object
foo.__call__ has method __call__ defined

foo.__call__.__call__ is a function...


This seems to go on forever.  How does calling foo() not lead to 
an infinite loop while trying to execute?




More information about the Python-list mailing list