I also think that this (restricting the global function is_prime to input that look like integers) is a very elegant solution. I would actually guess that novice users tend to try global functions first, and I am often surprised how long it takes some people to discover tab-completion.
Martin Am Mittwoch, 28. März 2018 14:02:41 UTC+2 schrieb John Cremona: > > I agree with both Marc's last 2 suggestions. If the global function > is_prime() is called on an integer (even of type Rational) it should do the > natural thing. Anything else raises an error with a helpful message that > x.is_prime() might be what is wanted. > > On Wed, 28 Mar 2018, 12:19 Marc Mezzarobba, <ma...@mezzarobba.net > <javascript:>> wrote: > >> Dima Pasechnik wrote: >> > is_prime() should be restricted to rings in which one can have >> > non-trivial prime elements >> >> Well, that's what I'm doubting. If the goal is that the global >> is_prime() function doesn't do anything surprising for people who would >> have integers in mind, then it may be better to restrict it to plain >> integers. >> >> >> >> >> -- >> Marc >> >> -- >> 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+...@googlegroups.com <javascript:>. >> To post to this group, send email to sage-...@googlegroups.com >> <javascript:>. >> Visit this group at https://groups.google.com/group/sage-devel. >> For more options, visit https://groups.google.com/d/optout. >> > -- 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.