what to do when instance of class fails to initialize ?
fredrik at pythonware.com
Wed Aug 20 10:41:06 CEST 2003
Tom Van den Brandt wrote:
> If I have an __init__ for a class and the initialisation can't go through
> (example: missing or wrong arguments), how do I return an error to the
> caller (from main() function)? When I do a return statement in the
> __init__ it says __init__ should return None... I can stop the flow with
> raise 'BlahBlah'. But then the program exits.
> What is the nice way to do this ?
catch the exception:
<!-- (the eff-bot guide to) the python standard library (redux):
More information about the Python-list