[Python-Dev] Making PyInterpreterState an opaque type

MRAB python at mrabarnett.plus.com
Thu Feb 21 14:15:43 EST 2019

On 2019-02-21 12:53, Antoine Pitrou wrote:
> On Thu, 21 Feb 2019 13:45:05 +0100
> Victor Stinner <vstinner at redhat.com> wrote:
>> Le jeu. 21 févr. 2019 à 12:36, Antoine Pitrou <solipsis at pitrou.net> a écrit :
>> >
>> > On Thu, 21 Feb 2019 12:13:51 +0100
>> > Victor Stinner <vstinner at redhat.com> wrote:  
>> > >
>> > > Premature optimization is the root of all evil. Most C extensions use
>> > > premature optimization  
>> >
>> > How do you know it's premature?  Some extensions _are_ meant for speed.  
>> Sorry, I don't ask to stop optimizing C extension. I'm asking to stop
>> to use low-level C API like PyTuple_GET_ITEM() if the modified code is
>> the not the performance bottleneck.
> As long as some people need that API, you'll have to maintain it
> anyway, even if _less_ people use it.  Ingesting lists and tuples as
> fast as possible is important for some use cases.  I have worked
> personally on some of them (on e.g. Numba or PyArrow).
If I'm working with a dict, the first place I look is PyDict_*, and that 
leads me to PyDict_GetItem. The docs for PyDict_GetItem don't mention 
PyObject_GetItem. Perhaps, if PyObject_GetItem is recommended, it should 
say so, and similarly for other parts of the API.

More information about the Python-Dev mailing list