Hi Andy, On 2018-09-23, Andy Howell <a...@gamubaru.com> wrote: > I'd guess the word "tricks" was objectionable. What I meant was > techniques like locating the source using funcName? Now that I know that > exists, I can add it to my "practice". Discovering those though google > searches takes time. I'd rather have a catalog of them in a known place. > Sadly my memory is not getting better with age. Having one place to > check speeds the process.
Searching for the sources should actually be easy: Put ?? after the object you want to study, and hit return (or shift-return in a notebook). This is supposed to show you the source code of the object. Also, if you want to directly *edit* the source code, it is possible to do edit(object_you_are_investigating, 'vim') (where the string 'vim' is supposed to be the name of your favourite editor ;-) That said, I am hardly using edit(...) myself, usually I just look up what file is relevant (by ??) and open it in geany. Of course, after altering the source code, you'd need to run "sage -b" (or "sage -br") to build the changes (or build the changes and restart sage). Note that you'll find introspection stuff in sage.misc.sageinspect, such as this: sage: from sage.misc.sageinspect import sage_getfile sage: P.<x,y,z> = QQ[] sage: sage_getfile(P) '/home/king/Sage/git/sage/local/lib/python2.7/site-packages/sage/rings/polynomial/multi_polynomial_libsingular.pyx' sage: sage_getfile(x) '/home/king/Sage/git/sage/src/sage/rings/polynomial/multi_polynomial_libsingular.pyx' However, be warned: I just notice that the anser of sage_getfile(P) is wrong (the source file is NOT in local/lib/..., but of course in src/sage/rings/... Only the anser for sage_getfile(x) is correct. Question to all: Is there already a ticket for the wrong behaviour of sage_getfile? >> How to I find the code being called? >> >> >> %prun is reasonably good for that. The foo?? is also very useful for >> looking at a particular block of code. If the code isn't pure python, %crun might also be useful (for performance analysis), although you need to install gperftools to make it work. Best regards, Simon -- 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 sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.