[Python-Dev] Changing Clinic's output

Serhiy Storchaka storchaka at gmail.com
Tue Jan 7 21:39:02 CET 2014


07.01.14 21:53, Antoine Pitrou написав(ла):
> Several core developers a bit unhappy with the way Argument Clinic
> currently scatters generated code into hand-written C modules. The
> opinion is that it makes C files more confusing and annoying to
> navigate through.
>
> Several solutions have been proposed:
> - move all generated code to separate C files, which would then be
>    #included'd into the main module file

Only this option will solve all my issues.

My arguments against current behavior:

* It increases the number of lines of code.

   now   with Argument Clinic

   1770       2704     Modules/audioop.c
   1572       1997     Modules/binascii.c
   3772       4558     Modules/_elementtree.c
   2712       3360     Modules/_sre.c
   3060       3742     Modules/_tkinter.c

More PageUp/PageDown needed to list the sources, and you should be more 
accurate wish positioning the scrollbar.

* It adds a lot of names which clutter up lists for navigation in your 
editor/IDE. For example if now there is only one name for the a2b_uu 
function in navigation list, with Argument Clinic there are three names: 
BINASCII_A2B_UU_METHODDEF, binascii_a2b_uu, and binascii_a2b_uu_impl 
(and only the last is interested for humans). If now the list of names 
fits in one screen, with Argument Clinic it will need three screens.

* It makes harder to use search for navigation. Now a2b_uu is occurred 
in the source file 6 times, and with Argument Clinic it will be occurred 
13 times (however moving generated code to separate file will decrease 
this number to 3).

* It mixes manually written code with generated boilerplate

* It clutters up hg log and hg blame results. Every time when you change 
clinic.py to generate different output, it touches multiple lines in all 
files which use Argument Clinic and clutters up their history.

* It makes the code more errorprone. Peoples can edit generated code 
instead of clinic declaration.

I have converted enough code to Argument Clinic last days and I seen how 
peoples work with already converted code, so I known what I say. If this 
doesn't convince you, I don't know what I can add.



More information about the Python-Dev mailing list