Andreas Kostyrka 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.

the NotImplementedError exception is usually a better choice:

    class AbstractBase:
        def method(self):
            raise NotImplementedError("'method' implementation missing")

</F>



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to