Skip to content

Remove-Zero-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.

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

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

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.