From: Raymond Hettinger Date: Thu, 1 Sep 2016 06:00:32 +0000 (-0700) Subject: Minor beautification (turn nested-if into a conjunction). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2f9cc7ab0c5e4c240b7412af2e33d086cd900077;p=python Minor beautification (turn nested-if into a conjunction). --- 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