mellit at gmail.com
Sun Oct 28 18:45:29 CET 2007
I am working on a Pari-Python module (see about GP/PARI at
http://pari.math.u-bordeaux.fr/). Similar project was started by
Stefane Fermigier 12 years ago (you can find a post about it on this
newsgroup). You can see some screenshots on my blog (http://
mellit.wordpress.com/2007/10/28/pari-python/). I reproduce the text on
my blog here.
I finished some working version of the pari-python module. I tried to
make it is close as possible to the standard PARI shell, at the same
time using the standard python syntax. Here I put some screenshots. I
didn’t make a proper package distribution for python (the code still
looks ugly and I still don't know how to make proper distributions),
but if someone is interested to test it send me an email. This is in
early alpha stage. A lot of things are not working. I imported almost
all functions of gp by an automated perl script but I don’t know which
of them actually work and which not.
There are two special difficulties you may notice about python. The
first one is the power operation. In python it is ‘**’, whereas ‘^’ is
reserved for the bitwise xor. I made some little changes to the python
source so that ‘^’ and ‘^=’ now work as power, and ‘^^’ and ‘^^=’ work
as xor if you still want to use it. This is done by modifying about 30
lines of source code in several files: Include/token.h, Modules/
parsermodule.c, Parser/tokenizer.c, Python/ast.c, Grammar/Grammar.
The second difficulty is that expressions like ‘1/2′ produce 0 in
python. For this my module installs my own handler for the operation
‘divide’ for integers and longs. That’s it. In other respects it is a
normal python module.
I will greatly appreciate any feedback.
More information about the Python-list