Minor code nit: Move an unrelated statement out of a try clause in Sequence.index (GH-32330)

This commit is contained in:
Géry Ogam 2022-04-06 20:03:36 +02:00 committed by GitHub
parent 884eba3c76
commit 59a99ae277
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -1022,10 +1022,10 @@ def index(self, value, start=0, stop=None):
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