Sorry, should have included a concrete example.  Although, as the others have 
said, I'm not sure how it helps with what you (seem) to want to do.

0 % cat bar.py
def the_answer(self):
   return 42
0 % cat foo.py
import bar

class A:
   pass


setattr(A, '__call__', bar.the_answer)

a=A()
print a()

class B(object):
   pass


setattr(B, '__call__', bar.the_answer)

b=B()
print b()

0 % python foo.py 
42
42


Cheers
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to