fork download
  1. class A(object):
  2. def A():
  3. print('factory')
  4. return A()
  5. def __init__(self):
  6. print('init')
  7. def __call__(self):
  8. print('call')
  9. print('chamar o construtor')
  10. a = A()
  11. print('chamar o construtor e a função')
  12. b = A()()
  13. print('chamar a função')
  14. c = A.A()
  15.  
  16. #https://pt.stackoverflow.com/q/109813/101
Success #stdin #stdout 0.02s 9120KB
stdin
Standard input is empty
stdout
chamar o construtor
init
chamar o construtor e a função
init
call
chamar a função
factory
init