__call__
TK
merman at o2online.de
Sat May 28 16:02:33 EDT 2005
Simon Percivall wrote:
> 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?
Sorry but it does not work. Here's my code:
>>> class Test(object):
... def __call__(self):
... print 'Hi'
...
>>> Test()
<__main__.Test object at 0x3e6d0>
o-o
Thomas
More information about the Python-list
mailing list