Remove-Unit-Step-From-Range
Documentation Index
Fetch the complete documentation index at: https://docs.sourcery.ai/llms.txt
Use this file to discover all available pages before exploring further.
Sourcery rule id: remove-unit-step-from-range
Section titled “Sourcery rule id: remove-unit-step-from-range”Description
Section titled “Description”Replace range(x, y, 1) with range(x, y)
Before
Section titled “Before”for i in range(y, len(x), 1): do_t()for i in range(y, len(x)): do_t()Explanation
Section titled “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.