Abstract Methods & Abstract Class

Gerald Klix Gerald.Klix at klix.ch
Thu Oct 20 10:32:38 CEST 2005


Isn't 

class AbstractBase:
    def method(self):
        raise NotImplementedError( "abstract method called" )

the right thing to do?

Gerald

----- Original Message ----- 
From: "Andreas Kostyrka" <andreas at kostyrka.org>
To: "Iyer, Prasad C" <prasad.c.iyer at capgemini.com>
Cc: <python-list at python.org>
Sent: Thursday, October 20, 2005 8:56 AM
Subject: Re: Abstract Methods & Abstract Class


> On Thu, Oct 20, 2005 at 12:05:05PM +0530, Iyer, Prasad C wrote:
> > 
> > Do we have something like abstract methods & Abstract class.
> > 
> > So that my class would just define the method. And the implementation
> > would be defined by somebody else.
> 
> class AbstractBase:
>     def method(self):
>         raise TypeError("abstract method called")
> 
> But basically, Python does not have abstract methods, and usually doesn't
> need them.
> 
> Andreas
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 



More information about the Python-list mailing list