Can __init__ not return an object?
Carsten Haese
carsten at uniqsys.com
Sat Apr 21 22:45:11 EDT 2007
On Sat, 2007-04-21 at 22:36 -0400, Steven W. Orr wrote:
> When I go to create an object I want to be able to decide whether the
> object is valid or not in __init__, and if not, I want the constructor to
> return something other than an object, (like maybe None).
> [...]
> Or would raising an
> exception in the constructor be appropriate?
Raising an exception is perfectly appropriate.
-Carsten
More information about the Python-list
mailing list