top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Timsort in Cpython

0 votes

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:

So of all the functions in there, could somebody point to me which one is timsort?

posted Jun 15, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote

Actually, it looks to me like it's several of them, but the main function is here:

answer Jun 15, 2013 by anonymous
+1 vote

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.

answer Jun 15, 2013 by anonymous
Similar Questions
+2 votes

Just wanted to clarify whether CPython already includes these kind of byte code optimizations? Are all the temporary variables removed when byte code is generated?

0 votes

I'm running a box with Debian squeeze, and I just ran:

sudo aptitude install jython

which ended up installing Python 2.5:

Linking and byte-compiling packages for runtime python2.5...
Setting up python2.5 (2.5.5-11) ...

Does anyone know why CPython 2.5 is a dependency for Jython 2.5.1+ on Debian squeeze?

+2 votes

I have an application which uses extensively python 2.7.6 (CPython).

The issue that I see is the following: "If there are only pyc files, the loading time of the application is much more than if I have pyc and py files. It is behind with 2 minutes more than if it had py files"

Do you have any idea why this is happening?

+1 vote

I have installed, de-installed and reinstalled this s/w and MySQL itself on my Win8 box. However, when I go to use it from a script, I get the following error:

"C:Python27libsite-packagesMySQLdb__init.py__", line 27 in  import _mysql
ImportError: DLL load failed: %1 is not valid Win32 application. 

I'm running Win8 which is 64-bit, Python 27, MySQL 5.5. Please help?

0 votes

Elective 1 options: Artificial neural networks, digital image processing, statistical machine learning
Elective 2 options : genetic algorithm and its application, computer vision