[Python-Dev] questionable try/except in anydbm.py

Tim Peters tim.one@comcast.net
Sun, 17 Mar 2002 20:56:09 -0500


[Skip Montanaro]
> I assigned bug 411881 to myself today and started looking through
> things to at least try to whittle down the number of cases that
> need to be considered.  Almost immediately I came across this code in
> anydbm.py:
>
>     try:
>         class error(Exception):
>             pass
>     except (NameError, TypeError):
>         error = "anydbm.error"
>
> Is this sort of construct really necessary?  It doesn't seem that
> any other exception definitions in the standard library fall back to
> string exceptions.

No, we've previously agreed that the Python library need not work with any
version of Python except the one it's released with.  There are developers
with a special interest in keeping a few specific libraries version-neutral,
but it's up to them to keep them that way.  You should feel free to get rid
of stuff like the above whenever you like.