New Python implementation

Dan Stromberg drsalists at gmail.com
Thu Feb 11 11:31:38 EST 2021


On Thu, Feb 11, 2021 at 4:35 AM Mr Flibble <flibble at i42.removethisbit.co.uk>
wrote:

>
> Hi!
>
> I am starting work on creating a new Python implementation from scratch
> using "neos" my universal compiler that can compile any programming
> language.  I envision this implementation to be significantly faster than
> the currently extant Python implementations (which isn't a stretch given
> how poorly they perform).
>

I'd like to encourage you to give this a go.  It's a huge task, but it's
needed.

You may be interested in the approaches of Pypy, Cython, Shedskin and
Nuitka.

Pypy is a Python written in RPython, where RPython is a restricted subset
of Python 2.  It can translate RPython to C, or JIT compile pretty full
Python code - 2.x or 3.x.  It has trouble with C extension modules, as the
CPython API for extension modules is pretty leaky. CFFI appears to be the
big hope of fixing this problem, but most C extension modules still use the
CPython C extension Module API.

Cython transpiles a Python-like language to C.  It allows you to intermix
Python datatypes and C datatypes; the more you use C datatypes, the faster
the result is.  It can be slower if you aren't careful with your type
conversions, but it can be faster if used well.  It has a really nice
--annotate option that shows how close to C your program is, line by line.

Shedskin transpiles an implicitly static subset of Python 2 to C++.  It's a
great tool, but sadly it is unlikely to make the jump from Python 2 to
Python 3, and Python 3 is definitely the future of Python.

Nuitka is a Python -> C/C++ transpiler.  I know little about it, but it
sounds kind of like what you're proposing.  It's been focusing on
compatibility first, followed by performance.

Good luck!


More information about the Python-list mailing list