On Thu, 13 Aug 2015, Nathann Cohen wrote:

All Sage methods that return integers should return Sage integer elements. Especially those that count something.

Do you know how to enforce this standard? Can it be done in the buildbot?

We cannot have something like that without making sure that all Sage functions will slowly converge and implement it. We have thousands of functions that do not respect this, and a standard is of little use unless it is respected.

But in any case it is better if these kind of things are pre-defined, at least as a default rule. Now I know that my suggestion to change the type to Integer is right, unless someone explains why this-and-this function should be an exception.

 * * *

Is it so that sage -t basically just compares strings? Can someone make a program that checks what expected outputs "seems like an integer", runs the corresponding test and tests the type of output? I.e. from

sage: Foo = Bar()
sage: Foo.xyzzy()
42

runs

Foo = Bar()
type(Foo.xyzzy())

and says when the output is not of type Integer? Of course it will give false positives, as 42 might be an element of GF(101), but it could at least help finding functions to correct.

--
Jori Mäntysalo

Reply via email to