Message 327897 - Python tracker

Message327897

Author cykerway
Recipients cykerway, serhiy.storchaka, steven.daprano, tim.peters, xtreak
Date 2018-10-17.13:50:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1539784223.12.0.788709270274.issue35010@psf.upfronthosting.co.za>
In-reply-to
Content
Multi-pass stable sorts should produce the correct result. But as the number of columns grow the code gets messy. For brevity this example only has 2 columns but it may be 10 or more in a real application. Furthermore, in some cases the application may need to remember which columns are sorted asc/desc so you have to keep that piece of data (termed `keyspec` but can be any meaningful name) anyway. It would be ideal if a builtin function can directly operate on this data instead of manually writing a multi-pass sorting logic;

The proposed prototype (`c.py`) is aimed at minimizing the amount of code needed to illustrate the problem and is not optimized for performance. There is a performance hit where it wraps one object into another, but this should be able to be avoided. If you want to compare real performance between single- and multi-pass sorts, you can run this script `performance.py` instead. My test result is that multi-pass sorting takes 75% more time, YMMV.
History
Date User Action Args
2018-10-17 13:50:23cykerwaysetrecipients: + cykerway, tim.peters, steven.daprano, serhiy.storchaka, xtreak
2018-10-17 13:50:23cykerwaysetmessageid: <1539784223.12.0.788709270274.issue35010@psf.upfronthosting.co.za>
2018-10-17 13:50:23cykerwaylinkissue35010 messages
2018-10-17 13:50:23cykerwaycreate