[Python-Dev] Sharing docstrings between the Python and C implementations of a module
Alexandre Vassalotti
alexandre at peadrop.com
Mon Apr 15 20:37:05 CEST 2013
On Mon, Apr 15, 2013 at 12:56 AM, David Lam <david.k.lam1 at gmail.com> wrote:
> I tried to find an example in the source which addressed this, but
> found that the docstrings in similar cases to be largely duplicated.
>
I find this annoying too. It would be nice to have a common way to share
docstrings between C and Python implementations of the same interface. One
roadblock though is functions in C modules often document their parameters
in their docstring.
>>> import _json
>>> help(_json.scanstring)
scanstring(...)
scanstring(basestring, end, encoding, strict=True) -> (str, end)
Scan the string s for a JSON string. End is the index of the
character in s after the quote that started the JSON string.
[...]
Argument clinic will hopefully lift this roadblock soon. Perhaps, we could
add something to the clinic DSL a way to fetch the docstring directly from
the Python implementation. And as an extra, it would be easy to add
verification step as well that checks the both implementations provide a
similar interfaces once we have this in place.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130415/09631d71/attachment.html>
More information about the Python-Dev
mailing list