Closed fchapoton closed 3 years ago
Branch: u/chapoton/32397
I did some more cleanup of the documentation and some PEP8 stuff. There are a lot of changes, but it is mostly from doing find-and-replace. If my changes are good, positive review.
New commits:
8ffa650 | More cleanup and changes of sloane_functions. |
Changed branch from u/chapoton/32397 to u/tscrim/32397
Reviewer: Travis Scrimshaw
ok, thanks. Let it be.
Can you comment on this and similar changes:
- return Integer(n)
+ return ZZ(n)
I was under the vague impression Integer(n)
should be preferred to ZZ(n)
.
Maybe because it's more direct? or slightly faster?
Doesn't ZZ(n)
call Integer(n)
in the end?
Travis removed an alias in this file that said Integer = ZZ
!
So the behaviour is the exact same behaviour as it was before.
Replying to @slel:
I was under the vague impression
Integer(n)
should be preferred toZZ(n)
.Maybe because it's more direct? or slightly faster? Doesn't
ZZ(n)
callInteger(n)
in the end?
I am never really sure which one to use. From a quick look, by calling Integer
, you avoid a trip through Sage's coercion check as ZZ._element_constructor_
is Integer
. So Integer(n)
is faster, but maybe less robust? Anyways, as Frédéric mentioned, this was just getting rid of an alias. Maybe I should have gotten rid of the ZZ(n)
calls and imported Integer
. Well, either way, I doubt this will be a bottleneck in any code and have an impact.
Importing ZZ
is needed here in any case
for ZZ.zero()
and ZZ.one()
.
I also doubt a few tens of nanoseconds will impact OEIS-related code.
All in all I am fine with either solution, I was just curious.
Changed branch from u/tscrim/32397 to 8ffa650
CC: @tscrim @slel
Component: combinatorics
Author: Frédéric Chapoton
Branch/Commit:
8ffa650
Reviewer: Travis Scrimshaw
Issue created by migration from https://trac.sagemath.org/ticket/32397