exception attributes

Andrew Dalke dalke at acm.org
Sun Aug 19 20:35:55 CEST 2001

Frederic Giacometti wrote:
>String exceptions refer to the exception value used when raising
>the exception.


>But even then, string exceptions must be associated to an exception class,
>to which the above rule applies...

Sorry?  I don't understand.  What's the exception class in the following?

>>> try:
...   raise "test2"
... except "test1":
...   print "Test1"
... except "test2":
...   print "Test2"
... except "test3":
...   print "Test3"

(NB: this is all old-style Python exceptions.  Use class based
exceptions for new code.)


More information about the Python-list mailing list