How about "pure virtual methods"?

Noam Raphael noamr at remove.the.dot.myrea.lbox.com
Tue Dec 21 20:05:39 EST 2004


Scott David Daniels wrote:
> class Abstract(object):
>     '''A class to stick anywhere in an inheritance chain'''
>     __metaclass__ = MustImplement
> 
> 
> def notimplemented(method):
>     '''A decorator for those who prefer the parameters declared.'''
>     return NotImplemented
> 

I just wanted to say that I thought of notimplemented as a class, that 
would save a reference to the functions it got in the constructor. In 
that way pydoc and his friends would be able to find the arguments the 
method was expected to get, and its documentation string.

But it's a great implementation.

Noam

Oh, and another thing - maybe "abstract" is a better name than 
"notimplemented"? notimplemented might suggest a method which doesn't 
have to be implemented - and raises NotImplementedError when it is 
called. What do you think?



More information about the Python-list mailing list