Ask Your Question
1

How to find the full argument list of a built-in function?

asked 2015-01-27 02:39:20 +0100

ikol gravatar image

updated 2015-01-27 09:22:12 +0100

FrédéricC gravatar image

My first use of Sage is utilizing its fantastic 3D plotting capabilities with Jmol. I am visualizing 3D curves from data points via line3d() and than using the show() method on the graphics objects. line3d? and show? give a short list of arguments such as color, thickness, radius for line3d, and frame for show. I know there are many more arguments, for example corner_cutoff for smoothing, but I only stumble upon them while browsing the Sage documentation. So far, I haven't found a source to list all the arguments for line3d or similar functions. I understand that these are Python wrappers and I tried things like dir() but I could not find more information than that given by line3d? Where am I going wrong? I am quite sure there are arguments controlling background color, the way frames and axes are labeled, etc. How can I find them? -Thanks.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2015-01-27 03:14:24 +0100

kcrisman gravatar image

This isn't really an answer, but a request; please help us improve the documentation here! You are right that this stuff is scattered all over the place. I have been using this stuff constantly for years and worked on the documentation many times, and hadn't even heard of the corner_cutoffargument, for instance :) (See http://trac.sagemath.org/ticket/3859 for that particular one.)

The short actual answer to your question is that there is not any place other than a lot of code browsing you can be sure to get everything; for example, much of the 2d stuff allows most matplotlib keywords, not all of which we necessarily document fully.

edit flag offensive delete link more
0

answered 2015-02-02 18:10:56 +0100

ikol gravatar image

updated 2015-02-03 02:45:12 +0100

kcrisman gravatar image

Thanks, that is sobering, but at least we know what to do. One thing I tried:

grep -rnw 'sage-6.4.1-x86_64-Linux' -e "def line3d"

sage-6.4.1-x86_64-Linux/src/sage/plot/plot3d/shapes2.py:47:def line3d(points, thickness=1, radius=None, arrow_head=False, **kwds):
sage-6.4.1-x86_64-Linux/src/build/lib.linux-x86_64-2.7/sage/plot/plot3d/shapes2.py:47:def line3d(points, thickness=1, radius=None, arrow_head=False, **kwds):
sage-6.4.1-x86_64-Linux/local/lib/python2.7/site-packages/sage/plot/plot3d/shapes2.py:47:def line3d(points, thickness=1, radius=None, arrow_head=False, **kwds):

Then, editing shapes2.py reveals other functions closely related to line3d() and the ? operator works for them in Sage to get their doc strings, but corners(), e.g., is defined within the Line class and the ? operator doesn't work with it. So, you are right, code browsing helps a bit, but it is quite counterintuitive.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2015-01-27 02:39:20 +0100

Seen: 755 times

Last updated: Feb 03 '15