On Aug 28, 7:43 pm, hwg <[EMAIL PROTECTED]> wrote:
> 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

sort() works on a list in place, and returns none

You have to make a temp list.

note...
>>> letters = ['d', 'a', 'e', 'c', 'b']
>>> print letters.sort()
None
>>> print letters
['a', 'b', 'c', 'd', 'e']

~Sean

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to