Remove Unit Step From Range¶
Sourcery refactoring id: remove-unit-step-from-range
¶
Description:¶
Replace range(x, y, 1)
with range(x, y)
Before:¶
for i in range(y, len(x), 1):
do_t()
After:¶
for i in range(y, len(x)):
do_t()
Explanation:¶
The default step
value for a call to range()
is 1
, so it is unnecessary to
explicitly define it. This refactoring removes this argument, slightly
shortening the code.