Why list.sort() don't return the list reference instead of None?

Robert Kern robert.kern at gmail.com
Mon May 8 08:41:44 CEST 2006


ankyhe at gmail.com wrote:
> L = [4,3,2,1]
> L=L.sort()
> L will refer to None, why L.sort() don't return the L?
> I want to ask why the designer of Python do so?

http://www.python.org/doc/faq/general/#why-doesn-t-list-sort-return-the-sorted-list

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco




More information about the Python-list mailing list