mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Kill reduce(). A coproduction of John Reese, Jacques Frechet, and Alex M.
This commit is contained in:
parent
6cefeb0e81
commit
89da5d7c3d
10 changed files with 25 additions and 144 deletions
|
@ -77,7 +77,9 @@ class TestBasicOps(unittest.TestCase):
|
|||
pop = range(n)
|
||||
trials = 10000 # large num prevents false negatives without slowing normal case
|
||||
def factorial(n):
|
||||
return reduce(int.__mul__, xrange(1, n), 1)
|
||||
if n == 0:
|
||||
return 1
|
||||
return n * factorial(n - 1)
|
||||
for k in xrange(n):
|
||||
expected = factorial(n) // factorial(n-k)
|
||||
perms = {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue