Hi,

Why doesn't this work? And is there way to have an
object immediately return a value or object once it is instantiated with
using a method call?


   1. >>> class k:
   2.         def __init__(self,n):
   3.                 return n*n
   4.
   5.
   6. >>> khalid=k(3)
   7. Traceback (most recent call last):
   8.   File "<pyshell#58>", line 1, in <module>
   9.     khalid=k(3)
   10. TypeError: __init__() should return None, not 'int'
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to