Except an exception AND all its subclasses?
Fredrik Lundh
effbot at telia.com
Fri Feb 11 17:04:48 EST 2000
More information about the Python-list mailing list
Fri Feb 11 17:04:48 EST 2000
- Previous message (by thread): Except an exception AND all its subclasses?
- Next message (by thread): Except an exception AND all its subclasses?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Gerrit Holl <gerrit.holl at pobox.com> wrote: > it's not possible to catch an exception and all its subclasses as > of python 1.5.2, is it? I'm tempted to say something about time machines, but afaik, this has been supported since the very beginning: http://www.python.org/doc/current/ref/try.html For an except clause with an expression, that expression is evaluated, and the clause matches the exception if the resulting object is "compatible'' with the exception. An object is compatible with an exception if it is either the object that identifies the exception, or (for exceptions that are classes) it is a base class of the exception, or it is a tuple containing an item that is compatible with the exception. also see: http://www.python.org/doc/FAQ.html#4.47 </F>
- Previous message (by thread): Except an exception AND all its subclasses?
- Next message (by thread): Except an exception AND all its subclasses?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list