S
Steven Bethard
I have two classes that implement the same interface, e.g. something like:
class C(object):
def foo(self):
"""Foo things"""
...
def bar(self):
"""Bar things"""
...
def baz(self):
"""Baz things in a C manner"""
...
class D(object):
def foo(self):
"""Foo things"""
...
def bar(self):
"""Bar things"""
...
def baz(self):
"""Baz things in a D manner"""
...
It bothers me that I'm basically writing the same docstrings multiple
times. I guess what I really want to do is just write the docstrings
for the interface I'm describing, and only supply docstrings in the
classes when they need to differ from the interface docstrings.
Is there a good way to do this? If it's necessary, I can have C and D
inherit from another class...
STeVe
class C(object):
def foo(self):
"""Foo things"""
...
def bar(self):
"""Bar things"""
...
def baz(self):
"""Baz things in a C manner"""
...
class D(object):
def foo(self):
"""Foo things"""
...
def bar(self):
"""Bar things"""
...
def baz(self):
"""Baz things in a D manner"""
...
It bothers me that I'm basically writing the same docstrings multiple
times. I guess what I really want to do is just write the docstrings
for the interface I'm describing, and only supply docstrings in the
classes when they need to differ from the interface docstrings.
Is there a good way to do this? If it's necessary, I can have C and D
inherit from another class...
STeVe