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

[Python-Dev] Deprecating "instance method" class

Let's stop here. This API is doing no harm, it's not a maintenance burden,
clearly *some* folks have a use for it. Let's just keep it, okay? There are
bigger fish to fry.

On Fri, Apr 5, 2019 at 5:36 AM Jeroen Demeyer <J.Demeyer at ugent.be> wrote:

> On 2019-04-05 15:13, Serhiy Storchaka wrote:
> > It is easy to implement a function in C.
> Why does it need to be a PyCFunction? You could put an actual method
> descriptor in the class. In other words, use PyDescr_NewMethod() instead
> of PyCFunction_New() + PyInstanceMethod_New(). It's probably going to be
> faster too since the instancemethod adds an unoptimized extra level of
> indirection.
> > Yes, this is what I want to do. I did not do this only because
> > implementing method-like functions which which do not belong to concrete
> > class implemented in C is not convention.
> Sure, you could implement separate methods like __gt__ in C, but that's
> still less efficient than just implementing a specific tp_richcompare
> for total_ordering and then having the usual wrapper descriptors for
> __gt__.
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/guido%40python.org

--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20190405/614afc50/attachment.html>