summaryrefslogtreecommitdiffstats
path: root/Lib/random.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2011-05-05 18:49:12 (GMT)
committerRaymond Hettinger <python@rcn.com>2011-05-05 18:49:12 (GMT)
commit102d874999c7491b4c918d68ac3a0bf63e5cd9dc (patch)
tree74babffe39a120607c9b3d8dc22a944204d918e6 /Lib/random.py
parentf90ba8a9a20f61c2a46d0881e39e558e39f968e8 (diff)
downloadcpython-102d874999c7491b4c918d68ac3a0bf63e5cd9dc.zip
cpython-102d874999c7491b4c918d68ac3a0bf63e5cd9dc.tar.gz
cpython-102d874999c7491b4c918d68ac3a0bf63e5cd9dc.tar.bz2
Sync-up minor code edits with the default branch.
Diffstat (limited to 'Lib/random.py')
-rw-r--r--Lib/random.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/random.py b/Lib/random.py
index 33d3634..59a4052 100644
--- a/Lib/random.py
+++ b/Lib/random.py
@@ -42,7 +42,7 @@ from types import MethodType as _MethodType, BuiltinMethodType as _BuiltinMethod
from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
from math import sqrt as _sqrt, acos as _acos, cos as _cos, sin as _sin
from os import urandom as _urandom
-import collections as _collections
+from collections import Set as _Set, Sequence as _Sequence
from hashlib import sha512 as _sha512
__all__ = ["Random","seed","random","uniform","randint","choice","sample",
@@ -293,10 +293,10 @@ class Random(_random.Random):
# preferred since the list takes less space than the
# set and it doesn't suffer from frequent reselections.
- if isinstance(population, _collections.Set):
+ if isinstance(population, _Set):
population = tuple(population)
- if not isinstance(population, _collections.Sequence):
- raise TypeError("Population must be a sequence or Set. For dicts, use list(d).")
+ if not isinstance(population, _Sequence):
+ raise TypeError("Population must be a sequence or set. For dicts, use list(d).")
randbelow = self._randbelow
n = len(population)
if not 0 <= k <= n: