Author: Philip Jenvey <[email protected]>
Branch: 
Changeset: r68405:d638fc970ebc
Date: 2013-12-09 16:56 -0800
http://bitbucket.org/pypy/pypy/changeset/d638fc970ebc/

Log:    minor cleanup

diff --git a/pypy/module/math/app_math.py b/pypy/module/math/app_math.py
--- a/pypy/module/math/app_math.py
+++ b/pypy/module/math/app_math.py
@@ -1,5 +1,7 @@
 def factorial(x):
-    """Find x!."""
+    """factorial(x) -> Integral
+
+    "Find x!. Raise a ValueError if x is negative or non-integral."""
     if isinstance(x, float):
         fl = int(x)
         if fl != x:
@@ -14,15 +16,15 @@
             res *= i
         return res
 
-    #Experimentally this gap seems good
-    gap = max(100, x>>7)
+    # Experimentally this gap seems good
+    gap = max(100, x >> 7)
     def _fac_odd(low, high):
-        if low+gap >= high:
+        if low + gap >= high:
             t = 1
             for i in range(low, high, 2):
                 t *= i
             return t
-        
+
         mid = ((low + high) >> 1) | 1
         return _fac_odd(low, mid) * _fac_odd(mid, high)
 
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to