Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '(at': 0.03; 'interpreter': 0.04; 'subject:Python': 0.05; 'compiler': 0.05; 'cpython': 0.05; 'builtin': 0.07; 'interpreter.': 0.07; 'ok.': 0.07; 'pypy': 0.07; 'works.': 0.07; 'python': 0.09; 'does,': 0.09; 'generators': 0.09; 'interpreter,': 0.09; 'meaningful': 0.09; 'oh,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'runtime': 0.09; 'looked': 0.10; '(usually)': 0.16; 'compiler,': 0.16; 'compiler?': 0.16; 'compilers': 0.16; 'eval': 0.16; 'from:addr:behnel.de': 0.16; 'from:addr:stefan_ml': 0.16; 'from:name:stefan behnel': 0.16; 'invoking': 0.16; 'message- id:@dough.gmane.org': 0.16; 'pointers,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'run.': 0.16; 'byte': 0.17; 'stefan': 0.17; 'obviously': 0.18; '>>>': 0.18; 'code,': 0.18; 'memory': 0.18; 'code.': 0.20; 'mostly': 0.20; 'written': 0.20; 'closely': 0.22; 'precise': 0.22; 'subject:skip:i 10': 0.22; 'runs': 0.22; "haven't": 0.23; 'paul': 0.24; 'specifically': 0.24; 'least': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'looks': 0.26; '(which': 0.26; 'compiled': 0.27; 'environment.': 0.27; 'guess': 0.27; 'executing': 0.27; 'execution': 0.27; 'first.': 0.27; 'i.e.': 0.27; 'library.': 0.27; "doesn't": 0.28; 'header:X-Complaints- To:1': 0.28; 'environment': 0.29; 'though.': 0.29; 'writes:': 0.29; 'objects': 0.29; 'maybe': 0.29; 'becomes': 0.30; 'stuff': 0.30; 'sense': 0.31; 'code': 0.31; 'system,': 0.32; 'received:84': 0.32; 'to:addr:python-list': 0.33; 'that,': 0.34; 'project': 0.34; 'done': 0.34; 'generic': 0.35; 'similar': 0.35; 'something': 0.35; 'received:org': 0.36; 'really': 0.36; 'explain': 0.36; 'but': 0.36; "didn't": 0.36; 'useful': 0.36; 'anything': 0.36; 'test': 0.36; 'skip:p 20': 0.36; 'does': 0.37; 'uses': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'some': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'subject:-': 0.40; 'header:Received:5': 0.40; 'think': 0.40; 'most': 0.61; 'real': 0.61; 'kind': 0.61; 'relatively': 0.62; 'different': 0.63; 'more': 0.63; 'choose': 0.65; 'management': 0.65; 'friendly': 0.71; 'carefully': 0.71; 'unusual': 0.71; 'life.': 0.81; 'counts': 0.81; 'clearly.': 0.84; 'compiles': 0.84; 'hardly': 0.84; 'huh?': 0.84; 'of*': 0.84; 'received:arcor-ip.net': 0.84; 'received:pools.arcor- ip.net': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Stefan Behnel Subject: Re: On-topic: alternate Python implementations Date: Sat, 04 Aug 2012 23:24:08 +0200 References: <501cbdf8$0$29978$c3e8da3$5496439d@news.astraweb.com> <501cff63$0$29978$c3e8da3$5496439d@news.astraweb.com> <7x1ujmabs9.fsf@ruckus.brouhaha.com> <7x1ujm1pwu.fsf@ruckus.brouhaha.com> <7xsjc2l766.fsf@ruckus.brouhaha.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: dslb-084-056-025-029.pools.arcor-ip.net User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 In-Reply-To: <7xsjc2l766.fsf@ruckus.brouhaha.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 75 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1344115460 news.xs4all.nl 6889 [2001:888:2000:d::a6]:52522 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:26510 Paul Rubin, 04.08.2012 22:43: > Stefan Behnel writes: >>> Calling CPython hardly counts as compiling Python into C. >> CPython is written in C, though. So anything that CPython does can be >> done in C. It's not like the CPython project used a completely unusual >> way of writing C code. > > CPython is a relatively simple interpreter, and executing code > by invoking such an interpreter IMHO doesn't count as "compiling" it in > any meaningful way. Oh, CPython is substantially more than an interpreter. The eval loop is only *one* way to use the runtime environment. Remember that it has many builtin types and functions as well as a huge standard library. Much of the runtime environment is already written in C or can be compiled down to C. If you compile Python code into C code that avoids the eval loop and only uses the CPython runtime environment (which is what Cython does), I think that qualifies as compiling Python code to C. It's definitely the most practical and user friendly way to do it. >> You will always need some kind of runtime infrastructure when you >> "compile Python into C", so you can just as well use CPython for that >> instead of reimplementing it completely from scratch. > > Maybe there's parts of Cpython you can re-use, but having the CPython > interpreter be the execution engine for "compiled" Python generators > again fails the seriousness test of what it means to compile code. If > you mean something other than that, you might explain more clearly. See above. >> Both Cython and Nuitka do exactly that, > > I didn't know about Nuitka; it looks interesting but (at least after a > few minutes looking) I don't have much sense of how it works. It's mostly like Cython but without the type system, i.e. without all the stuff that makes it useful in real life. Just a bare Python-to-C++-in-CPython compiler, without much of a way to make it do what you want. >> Last I heard, PyPy had a couple of GCs to choose from, > > PyPy doesn't compile to C RPython (usually) does, though, and my guess is that the memory management part of the runtime is written in RPython. > but I guess compiling to C doesn't preclude > precise GC, as long as the generated C code carefully tracks what C > objects can contain GC-able pointers, and follows some constraints about > when the GC can run. Some other compilers do this so it's not as big a > deal as it sounded like at first. OK. Yep, C really becomes a lot nicer when you generate it. >> Huh? LuaJIT is a reimplementation of Lua that uses an optimising JIT >> compiler specifically for Lua code. How is that similar to the Jython >> runtime that runs *on top of* the JVM with its generic byte code based >> JIT compiler? > > I thought LuaJIT compiles the existing Lua VM code, but I haven't > looked at it closely or used it. Ok. It obviously reuses code, but the VM part of it is really different from standard Lua. Stefan