[CentralOH] Nuitka vs Cython
James Bonanno
james at atlantixeng.com
Mon Apr 6 16:05:35 CEST 2015
In another follow up from last week, I compiled some basic programs with
Nuitka. It's actually somewhat impressive that you can compile a static
python program to a standalone C++ executable. For the various reasons
that I talked about last week, I still prefer Cython. However, Nuitka is
promising ...
Below I show a python file, math.py, that is compile to an executable in
one command line statement.
%% file math.py
def fib(n):
"""Print the Fibonacci series up to n."""
a, b = 0, 1
index = 0
while b < n:
print ("%d, %d, \n" % (index, b) )
a, b = b, a + b
index += 1
if __name__=="__main__":
fib(1000)
Here I compile with Nuitka and execute, in standalone mode:
james at saturn9 ~/crc $ nuitka --execute --standalone math.py
0, 1,
1, 1,
2, 2,
3, 3,
4, 5,
5, 8,
6, 13,
7, 21,
8, 34,
9, 55,
10, 89,
11, 144,
12, 233,
13, 377,
14, 610,
15, 987,
More information about the CentralOH
mailing list