Shouldn't __init__ return self instead of None? (Was: Re: [Tutor] Why error if method __init__ does not return none)
gerrit at nl.linux.org
Sat Mar 22 22:17:39 CET 2003
[FUP: python-list at python.org]
Bob Gailer schreef op zaterdag 22 maart om 18:05:29 +0000:
> What is "returned" here is an instance of the class, not what is returned
> by the __init__ method. I guess that "TypeError: __init__() should return
> None" is a way of telling you not to return something else with the
> expectation that it will be available.
This raises an interesting question. Shouldn't it say: __init__ should
return self...? Because _that_ is what it really does...
Of course, changing this would break code, but moving towards this might
be a good idea...?
30. If a chieftain or a man leave his house, garden, and field and
hires it out, and some one else takes possession of his house, garden, and
field and uses it for three years: if the first owner return and claims
his house, garden, and field, it shall not be given to him, but he who has
taken possession of it and used it shall continue to use it.
-- Hammurabi, Code of Law
Asperger Syndroom - een persoonlijke benadering:
Het zijn tijden om je zelf met politiek te bemoeien:
More information about the Python-list