[Python-checkins] cpython: Minor beautification (turn nested-if into a conjunction).

raymond.hettinger python-checkins at python.org
Thu Sep 1 02:00:46 EDT 2016


https://hg.python.org/cpython/rev/ebb23744a36c
changeset: 102984:ebb23744a36c
user: Raymond Hettinger <python at rcn.com>
date: Wed Aug 31 23:00:32 2016 -0700
summary:
 Minor beautification (turn nested-if into a conjunction).
files:
 Lib/random.py | 11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/Lib/random.py b/Lib/random.py
--- a/Lib/random.py
+++ b/Lib/random.py
@@ -119,12 +119,11 @@
 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
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /