I would use: if n not in ZZ: raise ValueError(...)
Best, Travis On Saturday, September 26, 2015 at 12:35:05 PM UTC-5, Jori Mäntysalo wrote: > > An example: > > sage: g = Graph({0:[1,2]}) > sage: list(g.breadth_first_search(0, distance='junk')) > [0, 1, 2] > > This can be corrected: try: n = Integer(...) ... if n<0: raise... > > But it seems stupid to mechanically copy this code. So should we add > something like _check_integer_all(), _check_integer_nonnegative() and > _check_integer_positive() to Sage? This way hopefully we would get more > checking for errors and have unified exception strings? > > -- > Jori Mäntysalo > -- 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 http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.