Except an exception AND all its subclasses?

Barry A. Warsaw bwarsaw at cnri.reston.va.us
Tue Feb 15 00:49:30 CET 2000

>>>>> "MZ" == Moshe Zadka <moshez at math.huji.ac.il> writes:

    MZ> Where the very beginning is defined as "from the time we
    MZ> stopped using string exceptions?". I'm sure there was no such
    MZ> feature when exceptions were strings. In fact, I distinctly
    MZ> remember a post by the other bot about how to simulate it with
    MZ> string exceptions.

Remember though, that class-based exceptions have been allowed for a
very long time, and AFAIK, the catch behavior for classes has been in
Python just as long.  The primary recent addition was the conversion
of the standard exceptions from strings to classes.  Using string
exceptions, you can still fake the derived class catch by sticking all
the string exceptions into a tuple and catching that.

    MZ> Sorry I didn't resist the temptation to mention time machines
    MZ> <0.5 wink>

No problem.  Guido's by far got the neatest one I been in, although it
can be dangerous for the novice to operate.  Besides that nasty first
step, you need to watch out for the blue knob, the bank of yellow
buttons below the chronometer, and if the snake shaped klaxon below
the chin rest ever starts to play the Monty Python theme song, be very
very afraid.


More information about the Python-list mailing list