]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Minor code nit: Move an unrelated statement out of a try clause in Sequence.index...
authorGéry Ogam <gery.ogam@gmail.com>
Wed, 6 Apr 2022 18:03:36 +0000 (20:03 +0200)
committerGitHub <noreply@github.com>
Wed, 6 Apr 2022 18:03:36 +0000 (13:03 -0500)
Lib/_collections_abc.py

index 86eb042e3a75ab195d50a399fe21de6699f47f18..e96e4c353558601b79984f62a44c3a13c52215f8 100644 (file)
@@ -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