newbie-question: abstract classes

Gerhard Häring gerhard.haering at gmx.de
Sat Sep 14 16:25:11 EDT 2002


* T. Kaufmann <merman at snafu.de> [2002-09-14 22:13 +0200]:
> Hi everybody,
> 
> I have a problem:
> 
> I want to create an abstract class but it doesn't work.
> What' s wrong here?
> 
> class Abstract:
> 
>     def __init__(self): return

Better style is to use "pass" instead of "return" here.

>     def method(self):   raise NotImplementedError
> 
> class Concrete: [...]

Use "class Concrete(Abstract):" instead.

HTH,

-- Gerhard




More information about the Python-list mailing list