"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

> I want to ask why the designer of Python do so?

I'm not a Python core developer nor a designer but I've always known that
sort() is a in-place sort and since the list is a mutable object it mutates the
list sending the "sort()" message. If you want to get back a sorted iterable
use... sorted :)

L = [3, 1, 2]
ls = sorted(L)

now ls is your list, sorted.

-- 
Lawrence - http://www.oluyede.org/blog
"Nothing is more dangerous than an idea
if it's the only one you have" - E. A. Chartier
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to