diff options
author | Collin Winter <collinw@gmail.com> | 2007-08-30 01:19:48 (GMT) |
---|---|---|
committer | Collin Winter <collinw@gmail.com> | 2007-08-30 01:19:48 (GMT) |
commit | ce36ad8a467d914eb5c91f33835b9eaea18ee93b (patch) | |
tree | 05bf654f3359e20b455dc300bd860bba5d291c8d /Lib/random.py | |
parent | 8b3febef2f96c35e9aad9db2ef499db040fdefae (diff) | |
download | cpython-ce36ad8a467d914eb5c91f33835b9eaea18ee93b.zip cpython-ce36ad8a467d914eb5c91f33835b9eaea18ee93b.tar.gz cpython-ce36ad8a467d914eb5c91f33835b9eaea18ee93b.tar.bz2 |
Raise statement normalization in Lib/.
Diffstat (limited to 'Lib/random.py')
-rw-r--r-- | Lib/random.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Lib/random.py b/Lib/random.py index 8a47178..e2bfcfd 100644 --- a/Lib/random.py +++ b/Lib/random.py @@ -157,18 +157,18 @@ class Random(_random.Random): # common case while still doing adequate error checking. istart = int(start) if istart != start: - raise ValueError, "non-integer arg 1 for randrange()" + raise ValueError("non-integer arg 1 for randrange()") if stop is default: if istart > 0: if istart >= maxwidth: return self._randbelow(istart) return int(self.random() * istart) - raise ValueError, "empty range for randrange()" + raise ValueError("empty range for randrange()") # stop argument supplied. istop = int(stop) if istop != stop: - raise ValueError, "non-integer stop for randrange()" + raise ValueError("non-integer stop for randrange()") width = istop - istart if step == 1 and width > 0: # Note that @@ -188,21 +188,21 @@ class Random(_random.Random): return int(istart + self._randbelow(width)) return int(istart + int(self.random()*width)) if step == 1: - raise ValueError, "empty range for randrange() (%d,%d, %d)" % (istart, istop, width) + raise ValueError("empty range for randrange() (%d,%d, %d)" % (istart, istop, width)) # Non-unit step argument supplied. istep = int(step) if istep != step: - raise ValueError, "non-integer step for randrange()" + raise ValueError("non-integer step for randrange()") if istep > 0: n = (width + istep - 1) // istep elif istep < 0: n = (width + istep + 1) // istep else: - raise ValueError, "zero step for randrange()" + raise ValueError("zero step for randrange()") if n <= 0: - raise ValueError, "empty range for randrange()" + raise ValueError("empty range for randrange()") if n >= maxwidth: return istart + istep*self._randbelow(n) @@ -300,7 +300,7 @@ class Random(_random.Random): n = len(population) if not 0 <= k <= n: - raise ValueError, "sample larger than population" + raise ValueError("sample larger than population") random = self.random _int = int result = [None] * k @@ -459,7 +459,7 @@ class Random(_random.Random): # Warning: a few older sources define the gamma distribution in terms # of alpha > -1.0 if alpha <= 0.0 or beta <= 0.0: - raise ValueError, 'gammavariate: alpha and beta must be > 0.0' + raise ValueError('gammavariate: alpha and beta must be > 0.0') random = self.random if alpha > 1.0: |