ruff/crates/ruff_linter/resources/test/fixtures/perflint/PERF203.py
2023-09-20 08:38:27 +02:00

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")