gh-104683: Argument clinic: make format_docstring() a method on Function objects#107840
gh-104683: Argument clinic: make format_docstring() a method on Function objects#107840AlexWaygood wants to merge 3 commits intopython:mainfrom
format_docstring() a method on Function objects#107840Conversation
|
Could you add tests for |
|
I am not sure that it is a good idea. I do not see benefits from this change. |
IMO, it makes most sense to render (and format) the docstring in Regarding where the docstring render code should live: perhaps a DocstringRenderer class that can take care of this is the best option. I see the value of keeping the Function class small. No matter where it ends up, I think it makes sense to tear this functionality out of the parser. |
Since the However, it is true that this PR does not fix any known bugs, so if we disagree that this improves readability, then it should be abandoned. It's also true that this would be a significant increase in the complexity of the
It's true that these facts about |
|
The problem is that
The |
|
Thanks @serhiy-storchaka, that seems like a solid analysis. Let's leave this for now, then, and save it for a more principled refactor. |
format_docstring()only ever modifies the internal state of theFunctionobject that isself.functionon theDSLParser. It makes much more sense for it to be an instance method onFunctionobjects rather thanDSLParserobjects.Tools/clinic/#104683