# help doesn't show function call

Hi,

When I look up matrix.add_multiple_of_row in Sage reference, I get:

Add s times column j to column i.

EXAMPLES: ...

If I do ?A.add_multiple_of_row in SageMath (in Jupyter, with the variable A = matrix(...)), I get

Docstring:

Add s times row j to row i.

EXAMPLES: ...

Note the critical line add_multiple_of_column(i, j, s, start_row=0) missing. Is it possible to see the function arguments and usage when using the ? form of help?

Thanks, Manoj

edit retag close merge delete

Sort by » oldest newest most voted

Hello. One possible way to do this is using the double question sign operator (??). For example:

A.add_multiple_of_row??


will show you something like

Source:
def add_multiple_of_row(self, Py_ssize_t i, Py_ssize_t j,    s,   Py_ssize_t start_col=0):
"""
Add s times row j to row i.

EXAMPLES: We add -3 times the first row to the second row of an
integer matrix, remembering to start numbering rows at zero::

sage: a = matrix(ZZ,2,3,range(6)); a
[0 1 2]
[3 4 5]
sage: a
[ 0  1  2]
[ 3  1 -1]


Etc...

Unfortunately, as you might guess, this was intended to show not only the docstring, but the whole code. That is why you see strange data types like Py_ssize_t, which comes from Cython, acombination of C and Python, in which this particular subroutine is written. If you don't know the meaning of the keyword self, it is safe to ignore it.

However, this should not be a problem, since the docstring will guide you further, and it is difficult to run into Cython implementations in every-day use of SageMath. Just ignore strange data types and also self: consider the signature of the subroutine to be

def add_multiple_of_row(i, j, s, start_col=0):


You can also use help(A.add_multiple_of_row), which will show the same, except for the part of the code. (I have not experimented much with this command.)

more

1

Thank you for your reply. Hope the SageMath team will include the function signature in the ? form of help in a future release, which will make the output much more useful.

( 2019-07-21 22:32:16 -0500 )edit