On Nov 29, 10:40 am, Stef Mientki <[EMAIL PROTECTED]> wrote: > Peter Decker wrote: > > On Nov 28, 2007 7:22 PM, stef mientki <[EMAIL PROTECTED]> wrote: > >> print 'xx3',ordered_list.sort() > > > The sort() method returns None. It sorts the list in place; it doesn't > > return a copy of the sorted list. > > Thank you all for the answers, > I do understand now, > although I find it rather non-intuitive. > I didn't expect a copy, but a reference to itself wouldn't be asked too much ? > Why does it return None, instead of the sorted object itself ? > I guess it would cost almost exactly the same processing power. > > cheers, > Stef Mientki
>From the Docs; The sort() and reverse() methods modify the list in place for economy of space when sorting or reversing a large list. To remind you that they operate by side effect, they don't return the sorted or reversed list. -- http://mail.python.org/mailman/listinfo/python-list