__init__ return value

Bob Gailer bgailer at alum.rpi.edu
Wed Sep 24 20:48:40 CEST 2003


At 12:35 PM 9/24/2003, Skip Montanaro wrote:


>     Facundo> The question is about the last two lines: When you call
>     Facundo> self.__init__(...), doesn't it return a value that you should
>     Facundo> return too?
>
>No, __init__ method return values are always ignored.

Oh?

 >>> class A:
...     def __init__(self):
...             return 'asdf'
...
 >>> A()
Traceback (most recent call last):
   File "<interactive input>", line 1, in ?
TypeError: __init__() should return None


Bob Gailer
bgailer at alum.rpi.edu
303 442 2625
-------------- next part --------------

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.506 / Virus Database: 303 - Release Date: 8/1/2003


More information about the Python-list mailing list