tan Sikonai wrote: > > ? You should wait at least 24 hours as many people in this mailing list are around the world and may not see this immediately.
> > 2013/8/20 sikonai sikonai <tanjyu...@gmail.com> > >>> list=[1,2,3,4,5,6,7,8,9] > >>> list[9:0:-2] > [9, 7, 5, 3] > >>> list[10:0:-2] > [9, 7, 5, 3] > > I want to know whether they have some difference. You should try and avoid using built-in names like "list" as this shadows list function. Yes, there is a difference. Python slices ignore out of range elements so this becomes the last element and elements with a -2 step (meaning traverse the list in reverse and select every other element) until you get to the 0th slot. >>> list[100:0:-2] [9, 7, 5, 3] ~Ramit This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor