[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] Comparing PEP 576 and PEP 580

On 2018-07-07 14:54, Mark Shannon wrote:
> There is a minimal implementation and has been for a while.
> There is a link at the bottom of the PEP.

Yes, I saw that but the implementation does not correspond to the PEP. 
In particular, this sentence from the PEP has not been implemented:

When binding a method_descriptor instance to an instance of its owning 
class, a bound_method will be created instead of a 

It's not clear to me whether you still want to implement that or whether 
it should be dropped from the PEP.

> PEP 576 adds a new calling convention which can be used by *any* object.
> Seems quite extensible to me.

Yes and no. Yes, it can do anything. But because it can do anything, 
callers cannot optimize certain special cases. For example, in PEP 576 
you need an extra flag Py_TPFLAGS_FUNCTION_DESCRIPTOR because your 
protocol doesn't specify anything about __get__. Imagine that you want 
to support more optimizations like that in the future, how do you plan 
to do that? Of course, you can always add more stuff to PyTypeObject, 
but a separate structure like what I propose in PEP 580 might make more