Re: [Python-Dev] Sharing docstrings between the Python and C implementations of a module

2013年4月15日 11:39:24 -0700

On Mon, Apr 15, 2013 at 12:56 AM, David Lam <[email protected]> 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.
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to