[Python-Dev] Sharing docstrings between the Python and C implementations of a module
Glenn Linderman
v+python at g.nevcal.com
Tue Apr 16 01:51:13 CEST 2013
On 4/15/2013 4:21 PM, Larry Hastings wrote:
> On 04/15/2013 09:31 AM, Eli Bendersky wrote:
>> Would it make sense to think about adding this in the scope of the
>> argument clinic work, or is it too unrelated? This seems like a
>> commonly needed thing for large parts of the stdlib (where the C
>> accelerator overrides Python code).
>
> From my perspective, the C accelerator doesn't override the Python
> code; the Python code is in charge, and elects to call the C accelerator.
>
> To answer your question, Clinic could help but I think it'd kind of
> suck. We'd have to use Clinic to preprocess the .py file and copy the
> docstring there, which would mean slurping in the C file. Clumsy but
> workable. We can talk about it once I finish the revised
> implementation, which should make processes like this much easier.
Since Clinic is mostly aimed at making C usage work with python, isn't
the above backwards? Wouldn't it be better to have Clinic slurp in the
Python code to find the docstrings, and then put them in the C code?
Then no need to preprocess the python file, just read it to obtain the
docstrings. You are already preprocessing the C code...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20130415/64da44e5/attachment.html>
More information about the Python-Dev
mailing list