John Salerno wrote: > Given: > > numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] > > can someone explain to me why > > numbers[10:0:-2] results in [10, 8, 6, 4, 2]? > > I thought the first index, whether going forward or backward, was > inclusive. And there is no index of 10 in this list, so what is it > referring to? > > Thanks.
Its referring to right after the end of the list, just as the 0 refers to just before the start of the list. The word "slice" is supposed to suggest cutting between (or before or after) elements. -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los Angeles, CA 90095 http://www.jamesstroud.com/ -- http://mail.python.org/mailman/listinfo/python-list