MartinThoma / flake8-simplify

❄ A flake8 plugin that helps you to simplify code
MIT License
185 stars 19 forks source link

[New Rule] Find consecutive slices #140

Open kasium opened 2 years ago

kasium commented 2 years ago

Explanation

Find consecutive slices which can be replaced by just one slice.

Example

foo = [1,2,3,4]

# Bad
foo[1:][:2]
foo[1:][2:]

# Good
foo[1:3]
foo[3:]