Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #40055
| From | Robin Becker <robin@reportlab.com> |
|---|---|
| Subject | Re: python 3 problem: how to convert an extension method into a class Method |
| Date | 2013-02-27 11:28 +0000 |
| References | <512CEF0C.3020906@chamonix.reportlab.co.uk> <kgivf6$ojl$1@ger.gmane.org> <512DE1AB.7000100@chamonix.reportlab.co.uk> <kgkpp6$rvm$1@ger.gmane.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2613.1361964551.2939.python-list@python.org> (permalink) |
On 27/02/2013 11:14, Peter Otten wrote:
........
> I think you misunderstood. You compare the time it takes to run the function
> coded in C and its Python equivalent -- that difference is indeed
> significant.
>
indeed. The function call overhead there looks pretty small so perhaps that's
the way forward.
> But what I was trying to measure was the difference between two ways to wrap
> the C function:
........
> I expect that you will get a similar result with your actual cfunc and
> therefore can (and should IMO) use method (1) in both Python 2 and 3
> -- but of course not being able to measure it myself it may turn out I'm
> wrong.
>
Thanks, I suspect function calls have got faster in later pythons so my fear of
the wrapper is outdated.
As others have pointed out I should probably be creating a method in C then I
should be able to do something like
class A:
def meth(self):
.....
from extension import c_dummy_class
A.meth = c_dummy_class.c_meth
--
Robin Becker
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: python 3 problem: how to convert an extension method into a class Method Robin Becker <robin@reportlab.com> - 2013-02-27 11:28 +0000
csiph-web