On 11/4/19 7:32 AM, R.Wieser wrote:
Hello all,

The whole question: How should I handle failed initialisation code inside
the __init__ of an object ?

I've seen an example doing a plain "return" (of the value "none""), but have
no idea if that is all it takes.

Also, I wonder what happens to the object itself.   Does it still exist and
only gets actually destroyed at the next garbage-collection (because of a
zero reference count), or is it directly discarded (without having called
the __del__ method) ?

Regards,
Rudy Wieser



Raise an exception. Returning None will specifically NOT accomplish the thing you want; nothing ever checks the return value of __init__.

--
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to