Why "class exceptions" are not deprecated?

Gregory Petrosyan gregory.petrosyan at gmail.com
Tue Mar 21 14:23:41 EST 2006

1) From 2.4.2 documentation:
There are two new valid (semantic) forms for the raise statement:
raise Class, instance
raise instance

2) In python:
>>> raise NameError
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
>>> help(NameError)
Help on class NameError in module exceptions: ...
>>> raise 0
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: exceptions must be classes, instances, or strings
(deprecated), not i

So, if it's a bug in documentation, it should be corrected. Otherwise,
(IMHO!) raising classes should be deprecated. Does raising class make
sence? As for me, I can't find any usefull case for it.

More information about the Python-list mailing list