Raising objects
Alex Martelli
aleax at aleax.it
Tue Apr 29 12:09:53 EDT 2003
Carlos P. wrote:
> Hi all,
>
> I have this short question: can the operator 'raise' raise exceptions
> which are instances of object? I'm getting the following behaviour
> from python 2.2.2:
No, in 2.2 (and 2.3 beta 1) exceptions must still be classic-classes
or instances thereof [or strings for backwards compatibility with the
dark and distant past], and should be derived from Exception (but this
is a recommendation, not enforced). I do not know when (or if) this
restriction will be removed -- in particular, because I do not know
of "use cases" where the ability to raise new-style classes or instances
thereof would be a major boon to an application. Maybe you have some...?
Alex
More information about the Python-list
mailing list