[Python-ideas] inheriting docstrings and mutable docstings for classes
steve at pearwood.info
Fri Jun 10 13:22:15 CEST 2011
David Stanek wrote:
> On Fri, Jun 10, 2011 at 3:04 AM, Greg Ewing <greg.ewing at canterbury.ac.nz>wrote:
>> Maybe the best thing would be for the inherited docstring
>> to get put into a different property, such as __basedoc__.
>> Then tools that examine docstrings can decide for themselves
>> whether using inherited docstrings makes sense.
> How would a tool know if the behavior of a method changed without analyzing
> the code? I think this could very easily lead to a situation where a
> project's generated documentation is incorrect.
That's the developer's problem, and no different from any other case
where you inherit data without ensuring it is the correct data.
colour = 'green'
return "Polly wants a cracker."
return "I'm pining for the fjords."
assert NorwegianBlue().colour == 'blue' # oops!
More information about the Python-ideas