Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!
4 events
when toggle format what by license comment
Jun 7, 2016 at 21:32 comment added farhadf One thing that tripped me up is that while for array x, x[-1] refers to the last element, x[-2:-1] does not refer to the last 2 elements, but rather just the second-to-last element. For Ruby programmers in particular, this is a common pitfall because you're used to having -1 be the last element and the .. notation is inclusive, i.e. x[-2..-1] returns the last 2 elements. The python colon ':' is actually the ruby triple-dot '...'
Jul 9, 2012 at 9:52 vote accept wap26
Jul 9, 2012 at 9:52 vote accept wap26
Jul 9, 2012 at 9:52
Jul 6, 2012 at 14:59 history answered Toomai CC BY-SA 3.0