mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:25:17 +00:00
49 lines
715 B
Python
49 lines
715 B
Python
# PERF203
|
|
for i in range(10):
|
|
try:
|
|
print(f"{i}")
|
|
except:
|
|
print("error")
|
|
|
|
# OK
|
|
try:
|
|
for i in range(10):
|
|
print(f"{i}")
|
|
except:
|
|
print("error")
|
|
|
|
# OK
|
|
i = 0
|
|
while i < 10:
|
|
try:
|
|
print(f"{i}")
|
|
except:
|
|
print("error")
|
|
|
|
i += 1
|
|
|
|
# OK - no other way to write this
|
|
for i in range(10):
|
|
try:
|
|
print(f"{i}")
|
|
break
|
|
except:
|
|
print("error")
|
|
|
|
# OK - no other way to write this
|
|
for i in range(10):
|
|
try:
|
|
print(f"{i}")
|
|
continue
|
|
except:
|
|
print("error")
|
|
|
|
|
|
# OK - no other way to write this
|
|
for i in range(10):
|
|
try:
|
|
print(f"{i}")
|
|
if i > 0:
|
|
break
|
|
except:
|
|
print("error")
|