Re: [Python-Dev] Deprecating "instance method" class
Just PyInstanceMethod_New, and by "adding methods to objects" this is adding C functions to types defined in C. Only appears to be called at module import / creation time. On Mon, Apr 8, 2019 at 10:24 AM Jeroen Demeyer wrote: > On 2019-04-08 17:08, Robert White wrote: > > So we're making pretty heavy use of PyInstanceMethod_New in our python > > binding library that we've written for a bunch of in house tools. > > If this isn't the best / correct way to go about adding methods to > > objects, what should we be using instead? > > First of all, the consensus in this thread is not to deprecate > instancemethod. > > Well, it depends what you mean with "adding methods to objects", that's > vaguely formulated. Do you mean adding methods at run-time (a.k.a. > monkey-patching) to a pre-existing class? And is the process of adding > methods done in C or in Python? > > Do you only need PyInstanceMethod_New() or also other > PyInstanceMethod_XXX functions/macros? > ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Deprecating "instance method" class
On 2019-04-08 17:08, Robert White wrote: So we're making pretty heavy use of PyInstanceMethod_New in our python binding library that we've written for a bunch of in house tools. If this isn't the best / correct way to go about adding methods to objects, what should we be using instead? First of all, the consensus in this thread is not to deprecate instancemethod. Well, it depends what you mean with "adding methods to objects", that's vaguely formulated. Do you mean adding methods at run-time (a.k.a. monkey-patching) to a pre-existing class? And is the process of adding methods done in C or in Python? Do you only need PyInstanceMethod_New() or also other PyInstanceMethod_XXX functions/macros? ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Deprecating "instance method" class
So we're making pretty heavy use of PyInstanceMethod_New in our python binding library that we've written for a bunch of in house tools. If this isn't the best / correct way to go about adding methods to objects, what should we be using instead? On Sun, Apr 7, 2019 at 2:17 AM Jeroen Demeyer wrote: > On 2019-04-07 09:48, Serhiy Storchaka wrote: > > total_ordering monkeypatches the decorated class. I'm planning to > > implement in C methods that implement __gt__ in terms of __lt__ etc. > > Yes, I understood that. I'm just saying: if you want to make it fast, > that's not the best solution. The fastest would be to implement > tp_richcompare from scratch (instead of relying on slot_tp_richcompare > dispatching to methods). > ___ > Python-Dev mailing list > Python-Dev@python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/robert.wd.white%40gmail.com > ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] bedevere pipelines hang on github
Thanks. Xavier ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com