On Mon, Sep 15, 2025 at 8:40 AM Ralf Hemmecke <[email protected]> wrote:
>
> On 9/15/25 15:26, Michael Orlitzky wrote:
> > In general I would suggest using plain python files rather than a sage
> > shell session for input. For example,
> >
> > #!/usr/bin/python3
> > from sage.all import *
> > print(ZZ(1) + ZZ(1))
> >
> > which can then be run with "sage -python" or (if you are using your
> > distro's sage, or have installed it using meson/pip) just "python".
>
> Oh, that sounds like a good idea.
>
> > Using sage as a python library avoids the ipython history entirely,
> > but the big downside is that you can't use any of the magic sage shell
> > preparsing.
>
> Hmmmm, I think that I would like to have preparsing. Since I generate my
> input files anyway ... is there perhaps a python script that does the
> translation for me?
there is a Python function for this:
$ python
Python 3.13.5 (main, Jul 15 2025, 09:22:39) [GCC 14.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from sage.all import preparse
>>> preparse("2^5")
'Integer(2)**Integer(5)'
>>>
HTH
Dima
>
> Thank you
> Ralf
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion visit
> https://groups.google.com/d/msgid/sage-devel/8deda600-4515-4082-bf8b-91e193108f5d%40gmail.com.
--
You received this message because you are subscribed to the Google Groups
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/sage-devel/CAAWYfq3STd5%3D1mvrkati521jwTN5vPurNW1%2B-QzRaT%2BihC2N5g%40mail.gmail.com.