@danso That's pretty great. I'd worry about using it in a shared codebase due to familiarity, but I wonder how much it helps reason about slicing and avoid off by one errors.
Aside: negative indexing seems like just about the most justified and high-reward sugar a language can have.
@danso I think the actual use of ~ in this context is mostly familiarity, like the !! truthiness trick. My biggest worry is that in places like slices and ranges it trips up the already confusing intuition around whether something is inclusive or exclusive.
It might defeat the point since it loses brevity, but you could get rid of the familiarity tax with a function.
fromEnd = lambda x: ~x
Eh, I like that less now that I've typed it out. But posting anyway for good measure.
Server run by the main developers of the project It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!