Skip to content

Remove-Zero-From-Range

Sourcery rule id: remove-zero-from-range

Description

Replace range(0, x) with range(x)

Before

for i in range(0, len(x)):
    do_t()

After

for i in range(len(x)):
    do_t()

Explanation

The default starting value for a call to range() is 0, so it is unnecessary to explicitly define it. This refactoring removes such zeros, slightly shortening the code.