Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'wrapper': 0.07; 'python': 0.09; 'function:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:into': 0.09; 'subject:method': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; 'subject:python': 0.11; 'extension': 0.13; '.........': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject: \n ': 0.16; 'subject:class': 0.16; 'later': 0.16; 'wrote:': 0.17; 'pointed': 0.17; 'thanks,': 0.18; 'equivalent': 0.20; 'trying': 0.21; 'import': 0.21; 'subject:problem': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'looks': 0.26; 'creating': 0.26; 'header:X -Complaints-To:1': 0.28; 'actual': 0.28; 'run': 0.28; 'coded': 0.29; 'measure': 0.29; 'overhead': 0.29; 'wrap': 0.29; 'probably': 0.29; 'class': 0.29; "i'm": 0.29; 'function': 0.30; 'expect': 0.31; '(and': 0.32; 'to:addr:python-list': 0.33; '(1)': 0.34; 'faster': 0.35; 'similar': 0.35; 'something': 0.35; 'there': 0.35; 'received:org': 0.36; 'but': 0.36; 'compare': 0.36; 'method': 0.36; 'should': 0.36; 'turn': 0.36; 'two': 0.37; 'being': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'takes': 0.39; 'header:Received:5': 0.40; 'think': 0.40; 'your': 0.60; 'between': 0.63; 'therefore': 0.65; 'received:109': 0.74; '.....': 0.75; 'forward.': 0.84; 'otten': 0.84; 'sfxlen:4': 0.84; 'pfxlen:big': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Robin Becker Subject: Re: python 3 problem: how to convert an extension method into a class Method Date: Wed, 27 Feb 2013 11:28:57 +0000 References: <512CEF0C.3020906@chamonix.reportlab.co.uk> <512DE1AB.7000100@chamonix.reportlab.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: python-list@python.org X-Gmane-NNTP-Posting-Host: 109.174.168.73 User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1361964551 news.xs4all.nl 6945 [2001:888:2000:d::a6]:38352 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:40055 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