On Mon, Nov 21, 2016 at 6:09 PM, Steven D'Aprano
<steve+comp.lang.pyt...@pearwood.info> wrote:
> try:
>     begin()
> except BeginError:
>     print("error in begin")
>     sys.exit(3)

Do you control the errors that are getting thrown?

class BeginExit(SystemExit, BeginError): pass

It'll behave like SystemExit, but still be catchable as BeginError.
(Or if BeginError isn't used anywhere else, it can itself be redefined
to inherit from SystemExit.)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to