From 78ffd6cffacb04bea61bb0ef850d05859ab2dbe4 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Fri, 18 Nov 2016 10:41:28 -0800 Subject: Issue #28705: greatly simplify the FAQ entry on transpiling. This also eliminats a dead link to Weave in the process. --- Doc/faq/design.rst | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/Doc/faq/design.rst b/Doc/faq/design.rst index 1b6cd7e..ea3de8a 100644 --- a/Doc/faq/design.rst +++ b/Doc/faq/design.rst @@ -366,33 +366,11 @@ is exactly the same type of object that a lambda expression yields) is assigned! Can Python be compiled to machine code, C or some other language? ----------------------------------------------------------------- -Practical answer: - -`Cython `_ and `Pyrex `_ -compile a modified version of Python with optional annotations into C -extensions. `Weave `_ makes it easy to -intermingle Python and C code in various ways to increase performance. -`Nuitka `_ is an up-and-coming compiler of Python -into C++ code, aiming to support the full Python language. - -Theoretical answer: - - .. XXX not sure what to make of this - -Not trivially. Python's high level data types, dynamic typing of objects and -run-time invocation of the interpreter (using :func:`eval` or :func:`exec`) -together mean that a naïvely "compiled" Python program would probably consist -mostly of calls into the Python run-time system, even for seemingly simple -operations like ``x+1``. - -Several projects described in the Python newsgroup or at past `Python -conferences `_ have shown that this -approach is feasible, although the speedups reached so far are only modest -(e.g. 2x). Jython uses the same strategy for compiling to Java bytecode. (Jim -Hugunin has demonstrated that in combination with whole-program analysis, -speedups of 1000x are feasible for small demo programs. See the proceedings -from the `1997 Python conference -`_ for more information.) +`Cython `_ compiles a modified version of Python with +optional annotations into C extensions. `Nuitka `_ is +an up-and-coming compiler of Python into C++ code, aiming to support the full +Python language. For compiling to Java you can consider +`VOC `_. How does Python manage memory? -- cgit v0.12