Re: why L[3:1]=['?'] become L.insert(3,'?')

2010-10-04 Thread sd44
在 2010-10-04一的 08:00 -0700,Richard Thomas写道: > > >>> L=[1,2,3,4] > > >>> L[3:1] > > [] > > >>> print L > > [1, 2, 3, 4] > > >>> L[3:1]=['?'] > Chard. thx for all,I know it ^^ thx -- http://mail.python.org/mailman/listinfo/python-list

why L[3:1]=['?'] become L.insert(3,'?')

2010-10-04 Thread sd44
In part III how does Python handle it if you try to extract a sequence in reverse, with the lower bound greater than the higher bound (e.g., L[3:1])? Hint: try assigning to this slice (L[3:1]=['?']), and see where the value is put. >>> L=[1,2,3,4] >>> L[3:1] [] >>> print L [1, 2, 3, 4] >>> L[3: