[Python-ideas] PEP draft: Unifying function/method classes

INADA Naoki songofacandy at gmail.com
Mon Apr 2 12:22:04 EDT 2018


On Tue, Apr 3, 2018 at 12:46 AM, Jeroen Demeyer <J.Demeyer at ugent.be> wrote:
> On 2018-04-02 12:39, INADA Naoki wrote:
>>
>> Thanks for writing such hard PEP.
>>
>> At first glance, it new type hierarchy seems OK.
>> But I can't understand rational for new flags.
>
>
> Which flags in particular do you mean? I just pushed an update explaining
> the rationale of METH_ARG0_FUNCTION:
>
> https://github.com/jdemeyer/PEP-functions#replacing-tp_call-meth_arg0_function
>

I meant all new flags.
Please note that most PEP readers doesn't read calling implementation everyday.
So it's unclear why METH_ARG0_NO_SLICE and METH_ARG0_FUNCTION should be added.

Actual example for METH_USR* flags are healpful too.


>> And it's very difficult to estimate runtime and maintenance cost of
>> the PEP, without draft implementation.
>
>
> Runtime cost: the goal is no slowdowns at all.
>

Good.

> Maintenance cost: IMHO, this PEP simplifies functions in CPython by removing
> special classes like method_descriptor so the effect should only be in the
> good sense.
>

I can't imagine it until PoC implementation.

>> FASTCALL is introduced in recently version, and it make implementation
>> complicated.
>> I'm afraid that this PEP make it worse.
>
>
> What do you mean? I am not making any changes to METH_FASTCALL.
>

When METH_FASTCALL is added, many special casing are added to support it.
I'm afraid adding new class means adding more special cases.


More information about the Python-ideas mailing list