flake8-pie icon indicating copy to clipboard operation
flake8-pie copied to clipboard

add rule `foo[0:bar]` can be rewritten as `foo[:bar]`

Open sbdchd opened this issue 4 years ago • 1 comments

maybe there's an edge case when someone overloads this? not sure

sbdchd avatar Apr 29 '21 16:04 sbdchd

This isn't really safe without type information:

class Foo:
    def __getitem__(self, key):
        print(key)

Foo()[:10]
# slice(None, 10, None)  
Foo()[0:10]                                                                              
# slice(0, 10, None)

sbdchd avatar May 06 '21 00:05 sbdchd