Pari Python

mensanator@aol.compost mensanator at aol.com
Sun Oct 28 15:15:08 EDT 2007


On Oct 28, 12:45 pm, Anton Mellit <mel... at gmail.com> wrote:
> Hi,
>
> I am working on a Pari-Python module (see about GP/PARI athttp://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.

Cool.

>
> 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.

Does your version use the GMP library (optional in PARI).
Does it support Windows? I couldn't tell if the PARI
Windows distribution has GMP, but I suspect not since GMP
doesn't support Windows.

> 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.

Oh, dear.

> 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.

Am I gonna have to re-compile Python?

That's imposible for ordinary Windows users.

Are you going to make a binary Windows distribution?

If not, it may as well be on the far side of the moon for
all the good it would be to me.

>
> 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.
>
> Anton





More information about the Python-list mailing list