Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #40055 > unrolled thread

Re: python 3 problem: how to convert an extension method into a class Method

Started byRobin Becker <robin@reportlab.com>
First post2013-02-27 11:28 +0000
Last post2013-02-27 11:28 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

#40055 — Re: python 3 problem: how to convert an extension method into a class Method

FromRobin Becker <robin@reportlab.com>
Date2013-02-27 11:28 +0000
SubjectRe: python 3 problem: how to convert an extension method into a class Method
Message-ID<mailman.2613.1361964551.2939.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web