Re: [sage-devel] Re: Library code returning int value

2021-07-12 Thread TB
Somewhat similar in spirit, I think that functions should try to return objects of the same type, unless explicitly called with an argument to change such behavior. It is not just the case of int and Integer. This might happen with Integer vs. Rational, wh

Re: [sage-devel] Re: Library code returning int value

2021-07-12 Thread David Roe
I think it's fine to include a discussion of this in the developer's manual: functions should return an integer rather than an int unless there is a good reason not to (mandated by the language for __len__, to reduce overhead for some internal functions). David On Mon, Jul 12, 2021 at 3:26 AM Kwan

[sage-devel] Re: Library code returning int value

2021-07-12 Thread Kwankyu Lee
On Monday, July 12, 2021 at 12:44:05 AM UTC+9 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 pre