summaryrefslogtreecommitdiff
path: root/Lib/random.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2016-08-31 23:00:32 -0700
committerRaymond Hettinger <python@rcn.com>2016-08-31 23:00:32 -0700
commit2f9cc7ab0c5e4c240b7412af2e33d086cd900077 (patch)
treed00f1217fec6ce0662a750164db5d702c13d418c /Lib/random.py
parent5f30f7935701cb0c62f498753ad79f19f24f10a1 (diff)
downloadcpython-git-2f9cc7ab0c5e4c240b7412af2e33d086cd900077.tar.gz
Minor beautification (turn nested-if into a conjunction).
Diffstat (limited to 'Lib/random.py')
-rw-r--r--Lib/random.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/Lib/random.py b/Lib/random.py
index 0178693ba9..13e115a8f4 100644
--- a/Lib/random.py
+++ b/Lib/random.py
@@ -119,12 +119,11 @@ class Random(_random.Random):
x ^= len(a)
a = -2 if x == -1 else x
- if version == 2:
- if isinstance(a, (str, bytes, bytearray)):
- if isinstance(a, str):
- a = a.encode()
- a += _sha512(a).digest()
- a = int.from_bytes(a, 'big')
+ if version == 2 and isinstance(a, (str, bytes, bytearray)):
+ if isinstance(a, str):
+ a = a.encode()
+ a += _sha512(a).digest()
+ a = int.from_bytes(a, 'big')
super().seed(a)
self.gauss_next = None