Hmm, this is a fairly old function, if I recall correctly, implemented relatively early on. There may be some discussion from where it was upgraded at http://trac.sagemath.org/ticket/16308 or http://trac.sagemath.org/ticket/16374 (I cannot find the original ticket, which surprises me).
So if you are interested in doing this, I would recommend opening a ticket and cc:ing the people involved on those tickets. I feel like your question is good, though one could certainly say this is a ValueError like dividing by zero. On Friday, December 5, 2014 9:52:20 AM UTC-5, Rolandb wrote: > > Hi, please look at the following example. > > sage: print two_squares(3437458237428) > Traceback (most recent call last): > ... > ValueError: 3437458237428 is not a sum of 2 squares > > > The ouput is an error message. Thus if I want to test several cases, I > have to check each case like: > > sage: for k in xrange(10): > ... try: > ... print two_squares(3437458237428-k), 3437458237428-k > ... except: > ... pass > (519651, 1779725) 3437458237426 > > > Why is the output not someting like []? > > This seems (to me) more natural, and as Python skips automatically an > empty list, programming is easier, lines are shorter and more readable > IMHO. It is also faster. > > My question is whether there are good reasons to raise a valueError > message as output? > > Roland > -- You received this message because you are subscribed to the Google Groups "sage-support" 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-support. For more options, visit https://groups.google.com/d/optout.
