Problem with Unittest:

Terry Reedy tjreedy at udel.edu
Tue May 13 14:20:59 EDT 2003


"Francis Avila" <francisgavila at yahoo.com> wrote in message
news:vc23a17s1t30e3 at corp.supernews.com...
> If you've gotten into the habit of raising exception instances
rather than
> classes, break it right now, or you'll be plagued with problems like
this.

Bad advice, I believe.  When you raise an exception class, it is
converted to an exception instance which is tested against the classes
listed in except statements with isinstance().  It has been suggested
on PyDev that raising instances directly might someday (Python 3.0) be
required.  IE, when raise string is disallowed, so might be raise
class.

TJR






More information about the Python-list mailing list