Le vendredi 08 septembre 2006 09:51, bearophileHUGS at lycos.com a ?crit?:
Frank Millman, just a short note, more expert people can give you
better answers. There aren't abstract classes in Python. They are all
concrete.
Frank Millman, just a short note, more expert people can give you
better answers. There aren't abstract classes in Python. They are all
concrete.
class AbstractClass(object) :
def __init__(self) : raise RuntimeError('Ths class is an abstract one !')
The abstract class can then define APIs (methods which raise
NotImplementedError) and/or logic (fully implemented methods).
With this scheme you are not stuck to the "API only" usage of abstract classes
like in Java nad its interfaces.
You may have classes with undefined methods (they may raise
NotImplementedError).
C++ "pure virtual methods" is only the C++ way of doing something which is aNotImplementedError).
more general concept in OOP.
--
_____________
Maric Michaud
_____________
Aristote - www.aristote.info
3 place des tapis
69004 Lyon
Tel: +33 426 880 097