Skip to content

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”

Replace range(x, y, 1) with range(x, y)

for i in range(y, len(x), 1):
do_t()
for i in range(y, len(x)):
do_t()

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.