[Python-Dev] PEP 590 discussion

Jeroen Demeyer J.Demeyer at UGent.be
Fri Apr 26 10:52:18 EDT 2019

On 2019-04-25 23:11, Petr Viktorin wrote:
> My thoughts are not the roadmap, of course :)

I asked about methods because we should aware of the consequences when 
choosing between PEP 580 and PEP 590 (or some compromise). There are 
basically 3 different ways of dealing with bound methods:

(A) put methods inside the protocol. This is PEP 580 and my 580/590 
compromise proposal. The disadvantage here is complexity in the protocol.

(B) don't put methods inside the protocol and use a single generic 
method class types.MethodType. This is the status-quo for Python 
functions. It has the disadvantage of being slightly slower: there is an 
additional level of indirection when calling a bound method object.

(C) don't put methods inside the protocol but use multiple method 
classes, one for every function class. This is the status-quo for 
functions implemented in C. This has the disadvantage of code duplication.

I think that the choice between PEP 580 or 590 should be done together 
with a choice of one of the above options. For example, I really don't 
like the code duplication of (C), so I would prefer PEP 590 with (B) 
over PEP 590 with (C).

More information about the Python-Dev mailing list