#19029: doctest Python vs Sage ints
-------------------------------------+-------------------------------------
Reporter: vbraun | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: sage-6.9
Component: user interface | Resolution:
Keywords: | Merged in:
Authors: Volker Braun | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/vbraun/doctest_python_vs_sage_ints|
129259d7e537f92b1e55fbb414477231117456fc
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by vdelecroix):
Replying to [comment:8 vbraun]:
> Too many doctest failures to fix in one go. Probably need
> * way to switch it on/off per directory
> * a doctest marker `# pyint` to allow python ints
> Also, do we really want to print ints differently; Maybe only in doctest
mode?
Note that the switch can easily be done with `sage -fixdoctests`.
+1 for doctest mode only. There are a lot of very used Python
functions/methods that will still return Python int
{{{
sage: [1,2,3,1,2,1].count(2)
2
sage: len([1,1,1])
3
sage: "hahaheho".find("he")
4
}}}
It would be too verbose to me to have `int(...)` everywhere.
`int(1)` is consistent with the fact that you can rebuild objects from the
string with `sage_eval`. That suggests a lighter marker: `1r`. What do you
think?
--
Ticket URL: <http://trac.sagemath.org/ticket/19029#comment:9>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.