__call__

Simon Percivall percivall at gmail.com
Sat May 28 11:12:23 EDT 2005


Look at http://docs.python.org/ref/callable-types.html

>>> class Test(object):
...     def __call__(self):
...         print "the instance was called"
...
>>> t = Test()
>>> t()
the instance was called

Is this what you wanted?




More information about the Python-list mailing list