A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-March/021993.html below:

R: [Python-Dev] Deprecating string exceptions

R: [Python-Dev] Deprecating string exceptionsNeal Norwitz neal@metaslash.com
Sat, 30 Mar 2002 13:14:35 -0500
Guido van Rossum wrote:
> 
> > The question is, whether, given
> >
> > class Base:pass
> > class MyExc(Base, Exception):pass
> >
> > it would be valid to write
> >
> > try:
> >   foo() # raises MyExc
> > except Base:
> >   pass
> 
> The "except Base:" class would of course be illegal because Base
> doesn't derive from Exception.  (Although the error might only be
> detected when MyExc is raised -- but PyChecker could do better.)  But
> the statement "raise MyExc" would be perfectly legal, and could be
> caught either with "except MyExc" or "except Exception".

There are several problems in the std library now:

	bdb.py:9	BdbQuit is a string exception
	macpath.py:173	norm_error is a string exception
	tabnanny.py:48	NannyNag does not derive from Exception
	xdrlib.py:12	ConversionError (Error) does not derive from Exception

Shall I make all of these derive from Exception?  
Is there any potential problems with doing so?

Neal



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4