Re: __init__ method and raising exceptions

2005-04-02 Thread NavyJay
Or better yet, define your own string/class exception to catch your errors. In my code, things can break in more than a few ways. In each case I catch the exception(s) specific to that piece of code, print a warning message to the user at sys.stdout and raise a new exception to be caught by my "w

Re: __init__ method and raising exceptions

2005-04-01 Thread Scott David Daniels
Vikram wrote: 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? maybe i don't fully understand your qn

Re: __init__ method and raising exceptions

2005-04-01 Thread NavyJay
Exactly the answer I was looking for! 12 hours of straight programming tends to fog ones mind. Thanks for making it clear! Jay -- http://mail.python.org/mailman/listinfo/python-list

Re: __init__ method and raising exceptions

2005-04-01 Thread Vikram
> 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? maybe i don't fully understand your qn but w

Re: __init__ method and raising exceptions

2005-03-31 Thread Leif K-Brooks
NavyJay wrote: 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 us

__init__ method and raising exceptions

2005-03-31 Thread NavyJay
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 '