New style classes as exceptions (Was: exception handing)

Fredrik Lundh fredrik at pythonware.com
Mon Jul 1 12:29:15 EDT 2002


Denis S. Otkidach wrote:

> This doesn't matter:
>
> >>> class o(Exception, object): pass
> ...

how come you aren't subclassing from Exception:

>>> class o(Exception):
...     pass
...
>>> try:
...     raise o("spam")
... except o:
...     print "OK"
...
OK

</F>





More information about the Python-list mailing list