Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2f9cc7a

Browse files
committed
Minor beautification (turn nested-if into a conjunction).
1 parent 5f30f79 commit 2f9cc7a

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

Lib/random.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,11 @@ def seed(self, a=None, version=2):
119119
x ^= len(a)
120120
a = -2 if x == -1 else x
121121

122-
if version == 2:
123-
if isinstance(a, (str, bytes, bytearray)):
124-
if isinstance(a, str):
125-
a = a.encode()
126-
a += _sha512(a).digest()
127-
a = int.from_bytes(a, 'big')
122+
if version == 2 and isinstance(a, (str, bytes, bytearray)):
123+
if isinstance(a, str):
124+
a = a.encode()
125+
a += _sha512(a).digest()
126+
a = int.from_bytes(a, 'big')
128127

129128
super().seed(a)
130129
self.gauss_next = None

0 commit comments

Comments
 (0)