Paul Pogonyshev proposed the creation of a tag to mark a function to be implemented in subclasses.
> How could I document such code?
> class AbstractFoo (object):
> def bar (self):
> # Not implemented.
> raise NotImplementedError
> I would like something as standing out as "class method" in bar()
> documentation, so that users really know they _must_ implement it
> in a subclass for it to work.
Such tag may be called "notimplemented" and carry a message describing what to implement. A shorter name may be advisable, but "abstract" usually has a different meaning; Docutils already has an "abstract" directive.
The tag should be dropped in case of inheritance, i.e. if a class implements a metod tagged @notimplemented in a base class, even if it inherits the docstring, the tag should be dropped.
If the source can be introspected, if the body of a function consists in a single statement "raise NotImplementedError('message')", a @notimplemented tag may be added to the function, with "message" as description.
Log in to post a comment.