Why doesn't __call__ lead to infinite recursion?

John J. Lee jjl at pobox.com
Sat Aug 16 07:19:50 EDT 2003


aahz at pythoncraft.com (Aahz) writes:
[...]
> you'll see __call__ there.  When you do foo(), Python actually does
> type(foo).__call__(foo).  Because type(foo).__call__ is manipulating
> foo, you don't get the circular reference.

Still seems weird that type(foo).__call__.__call__ (etc.) is defined.


John




More information about the Python-list mailing list