Newbie question - sorting a slice

hwg hwg434 at yahoo.com
Wed Aug 29 04:43:15 CEST 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