[Python-Dev] Breaking bug #411881 into manageable pieces
Guido van Rossum
guido@python.org
Thu, 21 Mar 2002 08:18:21 -0500
> Why can't we simply change the default for bare except clauses?
Because there's too much code that depends on it.
> I.e.
>
> try:
> ...
> except:
> ...
>
> gets equivalent to
>
> try:
> ...
> except StandardError:
> ...
>
> To catch everything, write:
>
> try:
> ...
> except Exception:
> ...
Not all exception classes derive from Exception.
> What about string exceptions?
Another good reason not to change the default. These won't be removed
from the language until Python 3.0 -- there's simply too much legacy
code that uses it. (We should try to issue warnings when a string
exception is raised or tested for though starting in 2.3.)
--Guido van Rossum (home page: http://www.python.org/~guido/)