Perhaps something towards (2) rather than (5), I believe the general principle is to have any method that a "standard" user will encounter to return a Sage Integer. The reasoning is exactly as you mentioned to avoid surprises to the user (e.g., why does "_.factor()" work for "foo" but not for "bar"?).
Best, Travis On Monday, July 12, 2021 at 1:44:05 AM UTC+10 Nils Bruin wrote: > I'd expect it's (1). A more nuanced version might be: > > (5) As a rule, an Integer should probably be returned if the code is > probably going to interact with other sage code, but if you have good > (efficiency) reasons to prefer a python integer or if the primary function > is to be compatible with other python code (such as "len" methods) then > returning a python integer should be fine. > > The reality is that the "python integer" type interwoven with the language > and sage cannot avoid it. > > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/8f60a8b1-5f90-47ad-9ff0-60d7620ad265n%40googlegroups.com.
