[Python-Dev] Changing Clinic's output

Zachary Ware zachary.ware+pydev at gmail.com
Tue Jan 14 21:48:34 CET 2014


On Tue, Jan 14, 2014 at 2:22 PM, Larry Hastings <larry at hastings.org> wrote:
> I have now received exactly zero feedback about the prototype, which
> suggests people aren't using it.

Oops, I had half a post written about this two days ago, but never got
it posted.

I did some experimenting on winreg.c (see
http://hg.python.org/sandbox/zware/file/prototype_clinic/PC/winreg.c),
and I have to say I really really like having most of the output
shunted down to the bottom of the file.  In that example I have only
the implementation outputting to the block, and everything else
(that's necessary) going into the buffer; to me it looks very nice and
clean.  One of my biggest annoyances with the current output is having
the docstring repeated nearly verbatim (with additives) within just a
few lines, and this takes care of that and more.  To me, those
converted functions read about as close to real Python as is ever
going to happen in a C file.

One thing that I could see being useful (though possibly not easy) is
the ability to dump a buffer "late"; for example, near the top of the
file:

/*[clinic input]
destination prototypes new buffer
output parser_prototype prototypes
dump prototypes later
[clinic start generated code]*/

Then process the file, filling the prototypes buffer as we go.  At the
end of the file, go back and dump the buffer in that output block.

I like the flexibility of the prototype, having more control over what
goes where is always nice :)

-- 
Zach


More information about the Python-Dev mailing list