__init__ method and raising exceptions

NavyJay gaudetteje at gmail.com
Thu Mar 31 22:12:09 EST 2005


I have a simple for-loop, which instantiates a class object each
iteration.  As part of my class constructor, __init__(), I check for
valid input settings.  If there is a problem with this iteration, I
want to abort the loop, but equivalently 'continue' on in the for-loop.

I can't use 'break' or 'continue' in a class method, nor can I return a
boolean value from __init__() to check for errors within the for-loop.
How would I be able to stop the current iteration and continue with the
next after reporting an error?

Jay




More information about the Python-list mailing list