__call__ question

Aahz aahz at pythoncraft.com
Tue Oct 1 21:02:48 CEST 2002

In article <mailman.1033487598.21842.python-list at python.org>,
Rick Richardson  <r.l.richardson at verizon.net> wrote:
>Your example gave me another variant that I should have tried but
>didn't expect to work, that is adding the function to the Class, not
>the instance :). It is interesting to note that the actual function
>call works for either the instance or the class, but the shortcut only
>works for the object if the assignment was made to the class.

New-style classes only automatically call special methods if they're
added to the class object.  Old-style classes will work if you add
special methods to the class or instance.
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Project Vote Smart: http://www.vote-smart.org/

More information about the Python-list mailing list