strange behaviour with decorators.

Antoon Pardon apardon at forel.vub.ac.be
Thu Feb 10 03:32:19 EST 2005


Op 2005-02-09, Delaney, Timothy C (Timothy) schreef <tdelaney at avaya.com>:
> Antoon Pardon wrote:
>
>> Ah, yes, the penny dropped. The try: except where there because
>> originally there were other statements I wanted to test and I
>> didn't want the raise exception by the inc(-2) stop the script.
>> I completely forget to consider it would also catch the
>> error I was expecting.
>
> A very good example of why you should (almost) never use a bare except:
> ...
>

Well in this case I would say the fault was not with the bare except:
The intention was to put the following.

except:
  print sys.excepthook(*sys.exc_info())


But I always forget this idiom, one with full "except" the other
abrviated to "exc", one in one word the other with an underscore
I always forget which is which and being in a hurry I just put
a pass thinking I would look it up and replace it later.

But before I did so I tested it a first time and was so surprised
I forgot.



More information about the Python-list mailing list