raising classes

Peter Hansen peter at engcorp.com
Mon Aug 19 19:17:41 EDT 2002


Aahz wrote:
> 
> Before I add to the current high volume on python-dev, does anyone know
> why the exception mechanism uses class objects rather than class
> instances.  In other words, why don't we do
> 
>     raise Exception()

Heh... some of us do exactly that! :)  In fact, I wasn't aware it
was possible to do it any other way.

Just another case of Python doing what you think it ought to do.
I came to Python after the old style was no longer the only style,
and never thought to read the docs on how to raise exceptions 
because "raise <instance>" just did what I want when I tried it.

-Peter



More information about the Python-list mailing list