summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGéry Ogam <gery.ogam@gmail.com>2022-04-06 20:03:36 +0200
committerGitHub <noreply@github.com>2022-04-06 13:03:36 -0500
commit59a99ae277e7d9f47edd4a538c1239d39f10db0c (patch)
tree35c745df76cb7f06392c61639b3433976ed09cba
parent884eba3c76916889fd6bff3b37b8552bfb4f9566 (diff)
downloadcpython-git-59a99ae277e7d9f47edd4a538c1239d39f10db0c.tar.gz
Minor code nit: Move an unrelated statement out of a try clause in Sequence.index (GH-32330)
-rw-r--r--Lib/_collections_abc.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/_collections_abc.py b/Lib/_collections_abc.py
index 86eb042e3a..e96e4c3535 100644
--- a/Lib/_collections_abc.py
+++ b/Lib/_collections_abc.py
@@ -1022,10 +1022,10 @@ class Sequence(Reversible, Collection):
while stop is None or i < stop:
try:
v = self[i]
- if v is value or v == value:
- return i
except IndexError:
break
+ if v is value or v == value:
+ return i
i += 1
raise ValueError