what to do when instance of class fails to initialize ?
Tom Van den Brandt
guineapig at pi.be
Wed Aug 20 03:43:17 EDT 2003
Hello !
As you might have guessed, I'm one of those newbie-types, comming here,
asking questions and stuff...
Very specific question, it's probably a bit basic so forgive me if it's
stupid to ask...
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 ?
Tnx,
--
Tom Van den Brandt
I try...
More information about the Python-list
mailing list