Python Distilled

Georg Brandl g.brandl-nospam at gmx.net
Mon Nov 6 05:26:11 EST 2006


Marc 'BlackJack' Rintsch wrote:
> In <1162790565.418382.237050 at m73g2000cwd.googlegroups.com>, Simon Wittber
> wrote:
> 
>> I'd also like to remove any deprecated or stuff which is left in for
>> backwards functionality (eg Classic classes).
> 
> Classic classes are still needed for exceptions:
> 
>>>> class E(object):
> ...    pass
> ...
>>>> raise E
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> TypeError: exceptions must be classes, instances, or strings (deprecated),
> not type

The error is a bit misleading, since in Python 2.5 all exceptions are new-style,
but new exception classes must be derived from an existing one.
Classic classes, their instances and strings are only allowed for backwards 
compatibility.

Georg



More information about the Python-list mailing list