[Python-Dev] PEP 580/590 discussion
encukou at gmail.com
Mon May 6 12:25:34 EDT 2019
On 5/6/19 3:43 AM, Jeroen Demeyer wrote:
> On 2019-05-06 00:04, Petr Viktorin wrote:
>> - Single bound method class for all kinds of function classes: This
>> would be a cleaner design, yes, but I don't see a pressing need. As
>> PEP 579 says, "this is a compounding issue", not a goal. As I recall,
>> that is the only major reason for CCALL_DEFARG.
> Just a minor correction here: I guess that you mean CCALL_SELFARG. The
> flag CCALL_DEFARG is for passing the PyCCallDef* in PEP 580, which is
> mostly equivalent to passing the callable object in PEP 590.
> The signature of PEP 580 is
> func(const PyCCallDef *def, PyObject *self, PyObject *const *args,
> Py_ssize_t nargs, PyObject *kwnames)
> And with PEP 590 it is
> func(PyObject *callable, PyObject *const *args, Py_ssize_t nargs,
> PyObject *kwnames)
> with the additional special role for the PY_VECTORCALL_ARGUMENTS_OFFSET
> bit (which is meant to solve the problem of "self" in a different way).
I worded that badly, sorry.
From PEP 590's `callable`, the called function can get any of these if
it needs to (and if they're stored somewhere). But you can't write
generic code would get them from any callable.
If we're not going for the "single bound method class" idea, that is OK;
`def` & `self` can be implementation details of the callables that need
More information about the Python-Dev