sourcery
sourcery copied to clipboard
Replace one item element slice for sequences like str with first slice index
Checklist
- [x] I think this refactoring is useful for everyone (if it's too specific, consider a custom rule)
- [x] I have checked there are no similar issues suggesting the same thing
Description
For "hello world"[4:5] this can be safely replaced with "hello world"[4] and I think the intent is much clearer. There might be other sequences this can be applied to but I'm not currently aware of any.
Code Before
"hello world"[4:5]
Code After
"hello world"[4]
Thanks - I've added this to our backlog.