[Python-Dev] API bloat
Mark Shannon
marks at dcs.gla.ac.uk
Thu Feb 10 11:16:04 CET 2011
Thanks to everyone for all their comments so far.
Martin v. Löwis wrote:
>> The functions may have been add to CPython 8 years ago, but they were
>> added to the API when they appeared in the docs, between 3.1 and 3.1.3.
>>
>> How is the API defined, if not by the documentation?
>
> Just to stress and support Georg's explanation: the API is *not* defined
> through the documentation, but instead primarily through the header
> files. All functions declared as PyAPI_FUNC and not starting with _Py
> are public API. There used to be a lot of undocumented API (up to 1.4,
> there was no API documentation at all, only the extension module
> tutorial); these days, more and more API gets documented.
Doing a search for the regex: "PyAPI_FUNC\([^)]*\) *Py" in .h files,
which should match API functions (functions starting _Py are excluded)
gives the following result:
Version matches
3.0 717
3.1.3 728
3.2b2 743
It would appear the API bloat is real,
not just an artefact of updated docs.
The "what's new for 3.2" API section:
http://docs.python.org/dev/py3k/whatsnew/3.2.html#build-and-c-api-changes
lists 6 new functions, yet according to my search, 15 have been added
between 3.1.3 and 3.2b2.
Of course 743 functions is about 700 too many,
but that's a discussion for Python-ideas and PEP 384.
Mark.
>
> HTH,
> Martin
>
More information about the Python-Dev
mailing list