Hacker News new | ask | show | jobs
by masklinn 2210 days ago
> Is this a typo or does inclusive/exclusive depend on whether first number is specified?

I hope it's a typo given:

> choose -3:-1 # print the last three items from a line

is clearly inclusive (otherwise it'd print but the last one), and there's a very explicit flag for inclusive ranges. Might be a good idea to open an issue just in case.

I not sure how to feel wrt using Python's range syntax with different inclusivity (by default) though.

edit: after installing and testing, it does seem like an error in the readme, the end is inclusive whether a start is provided or not. That is, `:3`, `0:3` and `1:3` all yield the 4th field.