Skip to content

Commit 18d1ad2

Browse files
committed
Removed unnecessary "if isinstance" check for speed.
1 parent 994e466 commit 18d1ad2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pendulum/duration.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ def _divide_and_round(a, b):
2424
# in Objects/longobject.c.
2525
q, r = divmod(a, b)
2626

27-
if isinstance(q, float):
28-
q = int(q)
27+
# The output of divmod() is either a float or an int,
28+
# but we always want it to be an int.
29+
q = int(q)
2930

3031
# round up if either r / b > 0.5, or r / b == 0.5 and q is odd.
3132
# The expression r / b > 0.5 is equivalent to 2 * r > b if b is

0 commit comments

Comments
 (0)