Ian Kelly <ian.g.ke...@gmail.com>:

> At least use "except Exception" instead of a bare except. Do you
> really want things like SystemExit and KeyboardInterrupt to get turned
> into 0?

How about:

==============================
    try:
        do_interesting_stuff()
    except ValueError:
        try:
            log_it()
        except:
            pass
        raise
==============================

Surprisingly this variant could raise an unexpected exception:

==============================
    try:
        do_interesting_stuff()
    except ValueError:
        try:
            log_it()
        finally:
            raise
==============================

A Python bug?


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

Reply via email to