Timsort in Cpython

alphonse23 at gmail.com alphonse23 at gmail.com
Sun Jun 16 00:05:09 EDT 2013


Yes I've read it. Very interesting read. There are other resources too online that make it very clear, for instance the wikipedia articles is pretty good.

Though, if anyone would be interested in helping me out further -- though by all means, I'm not lazy, I can figure it myself. But, I wanted to pass in variables into listsort and watch timsort work line by line in gdb. 

listsort(PyListObject *self, PyObject *args, PyObject *kwds)

I've never worked with Cpython source before, but it looks like PyObject is just some type of general strut.. I think anyway. How does python represent a list of ints in source? and what are the two second arguments for, assuming the first is the list strut.

On Saturday, June 15, 2013 12:44:01 PM UTC-7, alpho... at gmail.com wrote:
> I'm currently trying to make sense of Python's Timsort function. From the wikipedia page I was told the algorithm is located somewhere here: http://hg.python.org/cpython/file/default/Objects/listobject.c
> 
> 
> 
> So of all the functions in there, could somebody point to me which one is timsort?
> 
> 
> 
> Thanks, if anyone can help.
> 
> Alphonse23



More information about the Python-list mailing list