Skip to content

Commit 8bec057

Browse files
committed
-
1 parent bf4bf8d commit 8bec057

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

source_py3/python_toolbox/cute_iter_tools.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,7 @@ def is_sorted(iterable, key=None):
423423
from python_toolbox import misc_tools
424424
if key is None:
425425
key = misc_tools.identity_function
426-
for first_item, second_item in \
427-
cute_iter_tools.iterate_overlapping_subsequences(iterable):
426+
for first_item, second_item in iterate_overlapping_subsequences(iterable):
428427
if not key(second_item) >= key(first_item):
429428
return False
430429
else:

source_py3/python_toolbox/math_tools/factorials.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,18 @@
66
import itertools
77

88
infinity = float('inf')
9+
infinities = (infinity, -infinity)
910

1011

12+
def factorial(x, start=1):
13+
'''
14+
15+
This differs from the built-in `math.factorial` in that it allows a `start`
16+
argument.
17+
'''
18+
from python_toolbox import misc_tools
19+
return misc_tools.general_product(range(start, x+1), start=1)
20+
1121
def reverse_factorial(number, round_up=True):
1222
assert number >= 0
1323
if number == 0:

source_py3/python_toolbox/math_tools/misc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# This program is distributed under the MIT license.
33

44
import numbers
5+
import math
56

67

78
infinity = float('inf')

0 commit comments

Comments
 (0)