That's a common mistake of gophers. Golang has no negative index (yet?), but Python has.
Bad:
a[len(a) - 1]
a[len(a) + 1] # IndexError
Good:
a[-1]
a[1]
a[len(a) // 2]
The floor division is ok. Plus len and minus len isn't
a[len(a)-1] is slow, a[len(a)+1] is IndexError.
Awesome!
@kxepal do you have any comments on this?
Can I take this?
Let's start with #861
Later you can take as many as you want 馃檪
Can I take this one?
Done! Thanks! 馃憤
do you have any comments on this?
LGFM, except this case is quite rare one and mostly relates to migration from some Golang to Python. I can't find any similar issues in real Python code.
Hi @lensvol, how's it going? Do you need any help?
Hi @sobolevn, everything is on track, got distracted by real-life issues sadly :/ Hope I will close it this week.
Most helpful comment
Hi @sobolevn, everything is on track, got distracted by real-life issues sadly :/ Hope I will close it this week.