newbie-question: abstract classes

T. Kaufmann merman at snafu.de
Sat Sep 14 16:13:06 EDT 2002


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
     def method(self):   raise NotImplementedError

class Concrete:

     def __init__(self):
         Abstract.__init__(self)
         return
     def method(self):
         print "\n ... in Concrete!\n"

if __name__ == '__main__':

     #a = Abstract()
     #a.method()
     c = Concrete()
     c.method()

thanx for help

o-o

thomas




More information about the Python-list mailing list