Mercurial > cpython-lru_cache-weakref
diff Lib/random.py @ 68112:7f8da10bfcef
Fix imports from collections.abc
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Wed, 23 Feb 2011 00:46:28 +0000 |
| parents | f4f56efa2870 |
| children | be6c38d1817b |
line wrap: on
line diff
--- a/Lib/random.py Wed Feb 23 00:21:43 2011 +0000 +++ b/Lib/random.py Wed Feb 23 00:46:28 2011 +0000 @@ -42,7 +42,7 @@ 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.abc 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 @@ # 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:
