Kaydet (Commit) 2f9cc7ab authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Minor beautification (turn nested-if into a conjunction).

üst 5f30f793
...@@ -119,12 +119,11 @@ class Random(_random.Random): ...@@ -119,12 +119,11 @@ class Random(_random.Random):
x ^= len(a) x ^= len(a)
a = -2 if x == -1 else x a = -2 if x == -1 else x
if version == 2: if version == 2 and isinstance(a, (str, bytes, bytearray)):
if isinstance(a, (str, bytes, bytearray)): if isinstance(a, str):
if isinstance(a, str): a = a.encode()
a = a.encode() a += _sha512(a).digest()
a += _sha512(a).digest() a = int.from_bytes(a, 'big')
a = int.from_bytes(a, 'big')
super().seed(a) super().seed(a)
self.gauss_next = None self.gauss_next = None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment