#17119: Disallow pari(None)
-------------------------------------+-------------------------------------
Reporter: jdemeyer | Owner:
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-6.4
Component: interfaces | Resolution:
Keywords: | Merged in:
Authors: Jeroen Demeyer | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/jdemeyer/ticket/17119 | 4476266587733622582d32b1b7015c56ae97bf69
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by pbruin):
Replying to [comment:6 jdemeyer]:
> > - Always convert `gnil` to Python `None`, and make `pari(None)` return
`None`.
> That wouldn't work with composite objects: what should `pari([None, 1])`
be then?
Good point...
> > - Allow wrapping `gnil` (and possibly other PARI objects that are not
on the stack) in a Sage `gen` without copying it, so PARI recognises it as
`gnil`.
> Theoretically perhaps the best, but hard to do.
I agree. It may be tricky to implement the decision to copy or not in all
the necessary places. On the other hand, PARI just changes `gnil` to
`gen_0` in non-trivial situations:
{{{
gp > [if(0,1),1]
%1 = [0, 1]
}}}
> > - Stop treating `gnil` specially, identifying it with `gen_0`.
> I don't like this. It would lead to things like
> {{{
> sage: pari("print(12345)")
> 12345
> 0
> }}}
I agree that this is a bad solution.
> So... I still think it's best to disallow `pari(None)`. I see no use
case for it and the times where it did come up where all mistakes.
In other words, this comes down to a one-way conversion from PARI to
Python: whenever `gnil` arises we convert it to `None`, and we never
convert `None` back to `gnil`. Sounds reasonable.
--
Ticket URL: <http://trac.sagemath.org/ticket/17119#comment:7>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.