[issue20467] Confusing wording about __init__
Simeon Visser
report at bugs.python.org
Sun Nov 30 21:34:25 CET 2014
Simeon Visser added the comment:
Is it worth clarifying that __init__ can return a value but only the value None? The following won't raise a TypeError:
class O(object):
def __init__(self):
return None
Admittedly the "return None" is the default behaviour but people may attempt this in order to "block creation" of the instance (as __new__ is less well-known, I have seen the above attempted on Stack Overflow: http://stackoverflow.com/questions/26896941/proper-way-to-terminate-object-creation-inside-of-init/)
----------
nosy: +simeon.visser
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20467>
_______________________________________
More information about the Python-bugs-list
mailing list