Timsort in Cpython

Robert Kern robert.kern at gmail.com
Sat Jun 15 16:55:29 EDT 2013


On 2013-06-15 21:21, alphonse23 at gmail.com wrote:
> Hey guys,
> Thanks for the quick reply! So why did they decide to call it listsort in the source instead? Why didn't they keep it as Timsort?

This was the first implementation of the algorithm. The algorithm was only 
colloquially named "Timsort" after it was used in Python.

This the naming convention for the C implementation of builtin types' methods in 
the Python codebase. The C implementation listsort() corresponds with the Python 
method list.sort(). Similarly, listappend() is list.append(), listpop() is 
list.pop(), etc. C.f.

http://hg.python.org/cpython/file/default/Objects/listobject.c#l2362

-- 
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