Opened 9 years ago

Closed 6 years ago

#9662 closed defect (invalid)

gp(string) always returns a value, even when it should not

Reported by: jdemeyer Owned by: was
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: interfaces Keywords: pari
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

When executing a GP command using the Sage interface, a value of 0 is returned when None would be expected. For example, in a gp shell (started with sage -gp for example):

gp> kill(x)   /* No output */

But in Sage:

sage: gp('kill(x)')
0

Change History (3)

comment:1 Changed 9 years ago by jdemeyer

This is not easily fixed, it is due to the way how Expect assigns variables. In fact, one could argue that the observed behaviour is as expected, because in gp, we get

gp> a = kill(x)
0

So, assigning a nil value makes it into a zero.

comment:2 Changed 9 years ago by jdemeyer

  • Keywords pari added

comment:3 Changed 6 years ago by mhansen

  • Milestone changed from sage-5.11 to sage-duplicate/invalid/wontfix
  • Resolution set to invalid
  • Status changed from new to closed

I agree that this is invalid. Doing gp('kill(x)') means to create an object "kill(x)" in gp, assign it to a variable, and return a object pointing to that variable.

sage: type(gp('kill(x)'))
<class 'sage.interfaces.gp.GpElement'>

This is how it works for all the interfaces. If you just want to evaluate a command, then you can do

sage: gp.eval('kill(x)')
''

which appropriately returns an empty string.

Note: See TracTickets for help on using tickets.