Argument-Clinic / cpython

The Python programming language
https://www.python.org/
Other
1 stars 0 forks source link

Test: refactor format_docstring() #11

Closed erlend-aasland closed 1 year ago

erlend-aasland commented 1 year ago

Based off of the warn-and-fail branch, hence the commit history. The new commit with the format_docstring() refactor is 7ff262eb56752a78adfc99c2099b64cde1cb22e2 9df8da9168c5a45bba9bb09c614d328168edf34d.

erlend-aasland commented 1 year ago

I realised that the format_docstring() helpers I introduced do not rely on self; how about moving the whole docstring formatting over to Function, and do it at render time?

AlexWaygood commented 1 year ago

I realised that the format_docstring() helpers I introduced do not rely on self; how about moving the whole docstring formatting over to Function, and do it at render time?

Makes sense to me!

erlend-aasland commented 1 year ago

It is weird that Function.render_parameters is a property. It is named and used as a method. It is also called twice for each function; if we move the docstring rendering to render_function, we only need to "call" render_parameters once.

erlend-aasland commented 1 year ago

python/cpython#107623 (first step)