ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 31 Jul 2019 00:00:31 +0200Docstring docs and html docs are differenthttps://ask.sagemath.org/question/47317/docstring-docs-and-html-docs-are-different/If I try to type for example `factor?` in sage console It yields very detailed output with documentation based on dosctrings. But if I try to find `factor` in html\pdf docs (offline and [online](http://doc.sagemath.org/html/en/reference/search.html?q=factor&check_keywords=yes&area=default)) there is no such search results.
So two questions:
- How to get that complete docsrting help from outside sage console?
- Why they are different?
P.S. Example `factor?` output:
> **Signature:** `factor(n, proof=None, int_=False,
> algorithm='pari', verbose=0, **kwds)`
>
> **Docstring:** Returns the factorization of "n". The result
> depends on the type of "n".
>
> If "n" is an integer, returns the
> factorization as an object of type
> "Factorization".
>
> If n is not an integer,
> "n.factor(proof=proof, **kwds)" gets
> called. See "n.factor??" for more
> documentation in this case.
>
> Warning: This means that applying
> "factor" to an integer result
> of a symbolic computation will not factor the integer, because it
> is considered as an element of a larger symbolic ring.EXAMPLES:
>
> sage: f(n)=n^2
> sage: is_prime(f(3))
> False
> sage: factor(f(3))
> 9 ...petRUShkaWed, 31 Jul 2019 00:00:31 +0200https://ask.sagemath.org/question/47317/Incorrect parsing of docstring of sage.structure.indexed_generators.IndexedGeneratorshttps://ask.sagemath.org/question/25763/incorrect-parsing-of-docstring-of-sagestructureindexed_generatorsindexedgenerators/[This is more of a bug report, but I'm not sure how to report bugs.]
I'm running 'Sage Version 6.5.rc0, Release Date: 2015-01-29' and when I display the help for `sage.structure.indexed_generators.IndexedGenerators` I get some weird formatting error. It's coming from line 103 of the file `$SAGE_ROOT/local/lib/python2.7/site-packages/sage/structure/indexed_generators.py` where a \left is displayed as `<=ft`. It seems that `\le` in `\left` gets replaced by `<=`.
SLSat, 07 Feb 2015 10:28:31 +0100https://ask.sagemath.org/question/25763/docstring for my .py files does not work in Sage Notebook [UPD1]https://ask.sagemath.org/question/10629/docstring-for-my-py-files-does-not-work-in-sage-notebook-upd1/Hello!
Sage 5.10, Linux Mint 15 Cinnamon. <br>
I created new directory "pycode" in /home/andrei/ <br>
There is one file my_func.py in /home/andrei/pycode <br>
The context of my_module.py:
import sage.all
def my_func(a, b, c):
"""
hello!
"""
return(a+b+c)
In Sage Notebook I do the next:
import sys # 1st cell
sys.path.append('/home/andrei/pycode/') # 2nd cell
import my_module # 3rd cell
my_module.my_func? # 4 cell
I don't see any docstring in Sage Notebook. Where is the error? Please help me. Thanks.
----------------------------------------
**UPD1:**
I found the answer! :)
First of all I turned off and then launched sage notebook. After that I saw my docstring. Then I use Action... --> Restart worksheet.
Please explain me why shift+enter doesn't work for me. Thanks.
AndreWinSat, 19 Oct 2013 07:24:54 +0200https://ask.sagemath.org/question/10629/making docstrings using sphinx -- need a bit of helphttps://ask.sagemath.org/question/9373/making-docstrings-using-sphinx-need-a-bit-of-help/Hi,
I've done the following:
1) Downloaded ``sudo apt-get install python-setuptools`
2) Downloaded ``easy_install -U sphinx`` then navigated to my project directory ...sage/<project-name>
3) Ran ``sage -sh `` and ``sphinx-quickstart`` and followed the defaults except I chose separate directories for my build and source files.
4) Ran ``make latex`` and``make latexpdf``
It's blank! Please advise.
How can I ensure it picks up certain .py files? Any tips?SLOtoSFMon, 01 Oct 2012 06:29:46 +0200https://ask.sagemath.org/question/9373/unicode in doc stringshttps://ask.sagemath.org/question/8249/unicode-in-doc-strings/Hi!
Is it possible to use utf-8 characters in doc-strings? I tried to write description to __init__ method in russian language:
class Bazz:
def __init__(self):
"""
? ? ? ? ?
"""
pass
but then I write "Bazz(" and press tab:
> Traceback (most recent call last):
> File "", line 1, in File
> "_sage_input_66.py", line 10, in exec
> compile(u'print
> _support_.docstring("Bazz", globals(), system="sage")' + '\n', '', 'single')
> File "", line 1, in File
> "/opt/sage/devel/sagenb/sagenb/misc/support.py",
> line 263, in docstring return
> html_markup(s) File
> "/opt/sage/devel/sagenb/sagenb/misc/support.py",
> line 288, in html_markup return '
>
> ' + preamble + '
>
> ' + s + '
>
> ' UnicodeDecodeError: 'ascii' codec
> can't decode byte 0xd0 in position 11:
> ordinal not in range(128)
P.S. After I posted this question, site relapsed russian characters in code with '?' :-\EugeneSat, 30 Jul 2011 13:53:58 +0200https://ask.sagemath.org/question/8249/Using Sphinx to document a module using Sagehttps://ask.sagemath.org/question/7996/using-sphinx-to-document-a-module-using-sage/Hi all
I wrote a module using sage (first line : `from sage.all import *`)
My module contains quite a lot of docstrings with doctests that I want to be exported in html.
Following the documentation of Sphinx, I can create the source directory, but `make html` does not work :
<blockquote><p> "No module named sage.all" </p></blockquote>
Well. I understand why, but I don't see how to get further. The Sage's documentation says [how to sphinxify](http://www.sagemath.org/doc/reference/sagenb/misc/sphinxify.html) one docstring, but what I want is a html file with *all* my doctrings, that is, as far as I understood, the result of that :
.. automodule:: mymodule
:members:
I'm sure that it is possible : the whole documentation of Sage itself is made like that :)
In one word, I want to do "docstrings of my module -> html".
Any help is accepted
Thanks
Laurent
Laurent ClaessensSun, 13 Mar 2011 11:48:14 +0100https://ask.sagemath.org/question/7996/Why are Notebook docs different from CLI docs? What is Namespace "Interactive"?https://ask.sagemath.org/question/7680/why-are-notebook-docs-different-from-cli-docs-what-is-namespace-interactive/The sage terminal returns the following, but the notebook interface omits the "Base Class", "String Form", "Namespace", and "Length": <br>
<br> <hr>
sage: NaN? <br>
Type: Expression <br>
Base Class: type 'sage.symbolic.expression.Expression' <br>
String Form: NaN <br>
Namespace: Interactive <br>
Length: 0 <br>
File: /SAGE_DIR/local/lib/python2.6/site-packages/sage/categories/commutative\_rings.py <br>
Definition: NaN(self, \*args, \*\*kwds) <br>
Docstring: <br>
x.\_\_init\_\_(...) initializes x; see x.\_\_class\_\_.\_\_doc\_\_ for signature <br>
<hr> <br>ccanoncFri, 10 Sep 2010 00:07:04 +0200https://ask.sagemath.org/question/7680/Can I configure Sage's Terminal Mode to always call the pager for docstring queries?https://ask.sagemath.org/question/7645/can-i-configure-sages-terminal-mode-to-always-call-the-pager-for-docstring-queries/I just noticed when inspecting some common global variables, that the pager ("/usr/bin/less" usually) is only called for docstrings longer than a page. Sensible, but sometimes I don't want that.
sage: filter(lambda a:len(a)==2, dir())
['AA', 'CC', 'Ei', 'GF', 'GL', 'GO', 'GU', 'Gp', 'In', 'J0', 'J1', 'JH', 'Li', 'NN', 'QQ', 'Qp', 'Qq', 'RR', 'SL', 'SO', 'SR', 'SU', 'Sp', 'Sq', 'UP', 'ZZ', 'Zp', 'Zq', '\_2', '\_3', '\_4', '\_5', '\_6', '\_7', '\_8', '\_9', '\_\_', '\_i', 'db', 'gp', 'ln', 'mq', 'oo', 'os', 'pg', 'pi', 'sh']
sage: GU? (starts pager)
sage: GO? (just prints the docstring...same as "sage: print GO.\_\_doc\_\_")
Long docstrings really clutter the terminal. :~(
ccanoncFri, 27 Aug 2010 22:03:51 +0200https://ask.sagemath.org/question/7645/