@@ -366,33 +366,11 @@ is exactly the same type of object that a lambda expression yields) is assigned!
366366Can Python be compiled to machine code, C or some other language?
367367-----------------------------------------------------------------
368368
369- Practical answer:
370-
371- `Cython <http://cython.org/ >`_ and `Pyrex <https://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/ >`_
372- compile a modified version of Python with optional annotations into C
373- extensions. `Weave <https://scipy.github.io/devdocs/tutorial/weave.html >`_ makes it easy to
374- intermingle Python and C code in various ways to increase performance.
375- `Nuitka <http://www.nuitka.net/ >`_ is an up-and-coming compiler of Python
376- into C++ code, aiming to support the full Python language.
377-
378- Theoretical answer:
379-
380- .. XXX not sure what to make of this
381-
382- Not trivially. Python's high level data types, dynamic typing of objects and
383- run-time invocation of the interpreter (using :func: `eval ` or :func: `exec `)
384- together mean that a naïvely "compiled" Python program would probably consist
385- mostly of calls into the Python run-time system, even for seemingly simple
386- operations like ``x+1 ``.
387-
388- Several projects described in the Python newsgroup or at past `Python
389- conferences <https://www.python.org/community/workshops/> `_ have shown that this
390- approach is feasible, although the speedups reached so far are only modest
391- (e.g. 2x). Jython uses the same strategy for compiling to Java bytecode. (Jim
392- Hugunin has demonstrated that in combination with whole-program analysis,
393- speedups of 1000x are feasible for small demo programs. See the proceedings
394- from the `1997 Python conference
395- <http://legacy.python.org/workshops/1997-10/proceedings/> `_ for more information.)
369+ `Cython <http://cython.org/ >`_ compiles a modified version of Python with
370+ optional annotations into C extensions. `Nuitka <http://www.nuitka.net/ >`_ is
371+ an up-and-coming compiler of Python into C++ code, aiming to support the full
372+ Python language. For compiling to Java you can consider
373+ `VOC <https://voc.readthedocs.io >`_.
396374
397375
398376How does Python manage memory?
0 commit comments