idioms for abstract base classes

Erik Max Francis max at alcyone.com
Fri Apr 13 12:09:29 EDT 2001


Alex Martelli wrote:

> class B:
>     def __init__(self):
>         if self.__class__ == B:
>             raise AbstractClassException, B
>         # proceed with initialization tasks

Ah, that's a nice solution.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ Nothing spoils a confession like repentence.
\__/ Anatole France
    Interstelen / http://www.interstelen.com/
 A multiplayer, strategic, turn-based Web game on an interstellar scale.



More information about the Python-list mailing list