Skip to content

Remove Redundant Slice Index

Sourcery refactoring id: remove-redundant-slice-index

Description:

Removes unnecessary slice indices.

Before:

numbers[0 : len(numbers)]

After:

numbers[:]

Explanation:

The default starting value for a slice is 0, so it is unnecessary to explicitly define it. The default ending value is the end of the collection, so it is unnecessary to explicitly define this as well.

This refactoring removes unnecessary slice indices, slightly shortening the code.