By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,942 Members | 1,788 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,942 IT Pros & Developers. It's quick & easy.

Error managment question (Trace Backs ?)

P: n/a
vpr
Hi

This is a noob question, but here goes. I have a class that calls a
function.
class test:
def __init__(self):
if foo():
print "it worked"
else:
print "error"
def foo():
some test returns 1 or 0

Now in other langs like C / C++ I catch the error in foo and report and
exit.
However I suspect in python that I can raise it and the class can catch
it ?

Guess I'm new to Traceback's ,etc

Seeking Python Zen :)

Marinus

Sep 1 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"vpr" <mv*********@gmail.com> wrote:
This is a noob question, but here goes. I have a class that calls a
function. However I suspect in python that I can raise it and the class can catch
it ?


the "errors and exceptions" chapter in the tutorial might be helpful:

http://docs.python.org/tut/node10.html

(especially sections 8.3 and 8.4)

</F>

Sep 1 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.