On Do, 2010-01-28 at 12:16 +0100, spir wrote: > Is there a way to retrieve an (x)range's borders? > (Eg if I want to print out "m..n" instead of "xrange(m, n)".)
You mean like this? >>> m = 20 >>> n = 30 >>> a = xrange(m, n) >>> a xrange(20, 30) >>> a[0] 20 >>> a[-1] 29 Please note that the border will always be one step off if you're looking for the values you originally provided: the endpoint is always given as exclusive. If you want to know the step, you probably need to calculate it: >>> a = xrange(20, 30, 2) >>> step = a[1] - a[0] >>> step 2 Cheers, Alan Plum _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor