This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhpvorderman
Recipients Mark.Shannon, brett.cannon, mark.dickinson, rhettinger, rhpvorderman, serhiy.storchaka, tim.peters, vstinner, yselivanov
Date 2021-11-26.12:05:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1637928310.48.0.814520378811.issue45902@roundup.psfhosted.org>
In-reply-to
Content
I used it for the median calculation of FASTQ quality scores (https://en.wikipedia.org/wiki/FASTQ_format). But in the end I used the frequency table to calculate the median more quickly. So as you say, the frequency table turned out to be more useful.

Having said that the usefulness depends on how many times 8-bit data is passed into sorted. (bytes,bytearrays, most python strings are 8-bit I believe). I raised this issue not because I want a .sort() method on bytes or 
bytearrays, but mostly because I think python's sorted function can be improved with regards to 8-bit data. I think it is an interesting thing to consider, depending on how often this occurs.

For example:
sorted(b'Let\'s test a proper string now. One that has some value to be sorted.')
and 
list(bytes_sort(b'Let\'s test a proper string now. One that has some value to be sorted.'))

This returns the same result (a list of integers). But the byte_sort implementation is 2.5 times faster. So sorted is not optimally implemented here.

Since sorted is now basically throwing everything into list.sort an alternative codepath using bytes.sort can be considered. (If there are enough use cases for it).
History
Date User Action Args
2021-11-26 12:05:10rhpvordermansetrecipients: + rhpvorderman, tim.peters, brett.cannon, rhettinger, mark.dickinson, vstinner, Mark.Shannon, serhiy.storchaka, yselivanov
2021-11-26 12:05:10rhpvordermansetmessageid: <1637928310.48.0.814520378811.issue45902@roundup.psfhosted.org>
2021-11-26 12:05:10rhpvordermanlinkissue45902 messages
2021-11-26 12:05:10rhpvordermancreate