[Python-Dev] Breaking bug #411881 into manageable pieces

Walter Dörwald walter@livinglogic.de
Thu, 21 Mar 2002 11:13:36 +0100


Tim Peters wrote:
> [Aahz]
> 
>>May I suggest yet one more alteration:
>>
>>    try:
>>        ...code...
>>    except (KeyboardInterrupt,SystemExit):
>>        raise
>>    except:
>>        ...handler...
> 
> 
> Not unless you want to run around editing hundreds of modules.

Why can't we simply change the default for bare except clauses?
I.e.

try:
    ...
except:
    ...

gets equivalent to

try:
    ...
except StandardError:
    ...

To catch everything, write:

try:
    ...
except Exception:
    ...

What about string exceptions?

Bye,
    Walter Dörwald

-- 
Walter Dörwald · LivingLogic AG, Bayreuth/Germany · www.livinglogic.de