Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'c++,': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'seemed': 0.09; 'python': 0.11; 'both,': 0.16; 'code),': 0.16; 'entirely.': 0.16; 'from:addr:behnel.de': 0.16; 'from:addr:stefan_ml': 0.16; 'from:name:stefan behnel': 0.16; 'generator.': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'subject:Cython': 0.16; 'subject:Pypy': 0.16; 'types,': 0.16; 'all.': 0.16; 'so.': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'stefan': 0.19; '>>>': 0.22; 'header:User-Agent:1': 0.23; 'decide': 0.24; 'initial': 0.24; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'gives': 0.31; 'code': 0.31; 'figure': 0.32; 'yield': 0.36; 'next': 0.36; 'subject:?': 0.36; 'should': 0.36; 'half': 0.37; 'so,': 0.37; 'needed': 0.38; 'to:addr:python-list': 0.38; 'that,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'dave': 0.60; 'back': 0.62; 'become': 0.64; 'more': 0.64; 'selling': 0.65; 'between': 0.67; 'covers': 0.68; 'line,': 0.68; 'obvious': 0.74; 'special': 0.74; 'quicker': 0.84; 'received:87.139': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Stefan Behnel Subject: Cython - was: Future of Pypy? Date: Mon, 23 Feb 2015 16:43:41 +0100 References: <54eb10cf$0$44508$c3e8da3$66d3cc2f@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: p578ba676.dip0.t-ipconnect.de User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 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: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1424706233 news.xs4all.nl 2833 [2001:888:2000:d::a6]:58473 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:86229 Dave Farrance schrieb am 23.02.2015 um 15:13: > Dave Cook wrote: >> On 2015-02-22, Dave Farrance wrote: >> >>> It's still quicker to do a re-write in the more cumbersome C >> >> You should try Cython. > > I did try Cython when I was trying to figure out what to do about the slow > speed. My initial attempt showed no speedup at all. The documentation > told me that I needed to change the data types to special C-like types, so > it seemed to me that it would become half way between Python and C and > would be as cumbersome to develop as C. So at that point, I just rewrote > it in C. The main selling point of Cython is that, while it gives you the speed of C if you write C-ish code (because it translates it to the obvious C code), you don't have to write that C-ish code unless you decide to do so. Right the next line, you can use a set comprehension or yield a value back from a generator. So, it's not "half way between Python and C", it actually covers both, almost entirely. (Oh, and also C++, if you feel like it.) Stefan