one more exception newbie query

Payal payal-python at scriptkitchen.com
Fri Jun 4 06:10:20 EDT 2010


Hi all,
In http://docs.python.org/tutorial/errors.html#handling-exceptions it
says,

| >>> try:
| ...    raise Exception('spam', 'eggs')

Why would I want to use a class for exception? I could simply use raise
w/o it?
Also the help() says, 
class Exception(BaseException)
But we have used 'spam' and 'eggs'. Why?

| ... except Exception as inst:

Now what does "as inst" do here? (Is it making an instance, but how?
Aren't instances made with this, inst = Klass() ?)

Thanks a lot in advance.
With warm regards,
-Payal
-- 




More information about the Python-list mailing list