summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_random.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2006-08-22 00:21:25 (GMT)
committerGuido van Rossum <guido@python.org>2006-08-22 00:21:25 (GMT)
commit89da5d7c3d9cf5bfd4a374e23fd924bbffdeaf5c (patch)
treeaef767c70a3b57c4128d44816e4e070d28fffb9d /Lib/test/test_random.py
parent6cefeb0e8156406ac3f99248f6a3d3cd1536ca23 (diff)
downloadcpython-89da5d7c3d9cf5bfd4a374e23fd924bbffdeaf5c.zip
cpython-89da5d7c3d9cf5bfd4a374e23fd924bbffdeaf5c.tar.gz
cpython-89da5d7c3d9cf5bfd4a374e23fd924bbffdeaf5c.tar.bz2
Kill reduce(). A coproduction of John Reese, Jacques Frechet, and Alex M.
Diffstat (limited to 'Lib/test/test_random.py')
-rw-r--r--Lib/test/test_random.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py
index bba4c7c..afcf113 100644
--- a/Lib/test/test_random.py
+++ b/Lib/test/test_random.py
@@ -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 = {}