A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2019-April/156985.html below:

[Python-Dev] Deprecating "instance method" class

[Python-Dev] Deprecating "instance method" class [Python-Dev] Deprecating "instance method" classJeroen Demeyer J.Demeyer at UGent.be
Fri Apr 5 08:33:29 EDT 2019
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__.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4