Newbie question - sorting a slice

hwg hwg434 at yahoo.com
Tue Aug 28 22:43:15 EDT 2007


I've searched the group and didn't see the answer to this...

Why doesn't this work?:

>>> letters = ['d', 'a', 'e', 'c', 'b']
>>> letters[1:3].sort()
>>>

This returns None.

Why?  letters[1:3]  is  ['a', 'e', 'c']    Sorting that should return
['a', 'c', 'e']


hwg




More information about the Python-list mailing list