Skip to content

Remove zero from range

Sourcery refactoring id: remove-zero-from-range

Description:

Removes unnecessary explicit 0 argument from range

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.

Back to top