T
TK
Hi,
how can handle __call__? Can you give a sample?
Thanks
o-o
Thomas
how can handle __call__? Can you give a sample?
Thanks
o-o
Thomas
... def __call__(self):
... print "the instance was called"
...
the instance was called
Is this what you wanted?
Simon said:Look at http://docs.python.org/ref/callable-types.html
... def __call__(self):
... print "the instance was called"
...
the instance was called
Is this what you wanted?
TK said:Sorry but it does not work. Here's my code:
... def __call__(self):
... print 'Hi'
...
<__main__.Test object at 0x3e6d0>
TK said:Sorry but it does not work.
> ... def __call__(self):
> ... print 'Hi'
> ...
> <__main__.Test object at 0x3e6d0>
tiissa said:It _does_ work. It just don't do what you expect.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.