On 18/07/2006 11:17 PM, guthrie wrote: > Beginner question! :-) > > x=[1,2,3,4] > for i in range(len(x)): > print x[:-i] > > >>> [] > >>> [1,2,3] > >>> [1,2] > >>> [1] > > 1) The x[:-0] result seems inconsistent to me; > I get the idea that -0=0, so it is taken as x[:0] -> [] > 2) how then should one do this basic left-recursive subsetting (easily). > >
|>> for i in range(len(x), -1, -1): ... print x[:i] ... [1, 2, 3, 4] [1, 2, 3] [1, 2] [1] [] -- http://mail.python.org/mailman/listinfo/python-list