On 13Jun2019 0816, Jeroen Demeyer wrote:
On 2019-06-13 17:11, Steve Dower wrote:
The cost of that convenience is that
we can never optimise internals because they are now public API.

I think that the opposite is true actually: the reason that people access internals is because there is no public API doing what they want. Having more public API should *reduce* the need for accessing internals.

Right, but we need to know what API that is. We can't just make everything public by default.

For example, _PyObject_GetMethod is not public API but it's useful functionality. So Cython is forced to reinvent _PyObject_GetMethod (i.e. copy verbatim that function from the CPython sources), which requires accessing internals.

What's wrong with using PyObject_GetAttr() and then doing PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_METHOD_DESCRIPTOR) on the result?

More importantly, why do you need to know that it's a method descriptor and not just a callable object that can be accessed via an attribute? And is this something that's generally needed, or is Cython just special (I expect Cython to be special in many situations, which is why we have a tiered API and expect Cython-generated code to be regenerated for different CPython versions).

Once we start discussing actual API needs, we can get to real designs. Simply making everything public by default does not improve any designs.

Cheers,
Steve
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/HC7BTCWMFQAY3OHNRBPNKVKBXJSDH453/

Reply via email to