Problem with Unittest:

Terry Reedy tjreedy at udel.edu
Tue May 13 18:02:55 EDT 2003


"Steven Taschuk" <staschuk at telusplanet.net> wrote in message
news:mailman.1052852602.10413.python-list at python.org...
> Quoth Terry Reedy:
> > [...] 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.
>
> And here I am writing a PEP based on a similar recent discussion
> here in c.l.py.
>
> I applied Google to mail.python.org, but was unable to find the
> suggestion to which you refer.  Can you narrow my search space?

All I can find is

http://mail.python.org/pipermail/python-dev/2003-January/031907.html
[Python-Dev] Raising string exceptions

which only speaks of deprecating string exceptions, so I will have to
withdraw my claim about raising classes and py-dev.

Perhaps I mixed what I read with what I thought (and still think)
should also be done.  IE, I find it a bit confusing that one can
create an exception instance either directly with
exceptionclass(initarg) or indirectly with exceptionclass, initarg,
which latter gets translated to the former.  Two nearly identical ways
to do the same thing, one the standard way (elsewhere in the language)
and one unique to the particular context, seems rather useless.  One
should know that the exception object one gets with 'except
exceptionclass, obj:' is an instance of exceptionclass and not
exceptionclass itself.  This is much easier to remember if one raises
the instance directly instead of indirectly.  My opinion, anyway,
based on once having been confused on this issue.

Terry J. Reedy






More information about the Python-list mailing list