On Tue, Mar 27, 2018 at 11:06 AM, Nils Bruin <nbr...@sfu.ca> wrote: > On Tuesday, March 27, 2018 at 10:48:34 AM UTC-7, Ralf Stephan wrote: >> >> Nils, >> >> See https://trac.sagemath.org/ticket/21067 >> >> for a rational factor_list(). > > > I don't think that helps casual user's API at all. If I have to write > SR(12/4).factor_list(), I'd rather write ZZ(12/4).factor(). In fact, in sage > we already have: > sage: factor(12/21) > 2^2 * 7^-1 > so no complaints there. > > I think we can just put some novice-friendly logic in is_prime rather than > have the current implementation: > try: > return n.is_prime() > except (AttributeError, NotImplementedError): > return ZZ(n).is_prime()
But if n = 12/4, then n.is_prime() does not raise an error, since is_prime is defined in element.pyx in a generic way for ring elements. If we are going to change something in this case, probably Simon's suggestion to have a warning (that can be turned off) be printed by the top-level globalsI() is_prime when confronted with a field element seems best... It definitely won't break anybody's code, and avoids Ralf's confusion. William -- 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 https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.