[issue45902] Bytes and bytesarrays can be sorted with a much faster count sort.

Mark Dickinson report at bugs.python.org
Fri Nov 26 06:03:10 EST 2021


Mark Dickinson <dickinsm at gmail.com> added the comment:

Can you give example use-cases for sorting a bytes or bytearray object? I see value in the intermediate object - the frequency table, but the reconstructed sorted bytes object just seems like an inefficient representation of the frequency table, and I'm not sure how it would be useful.

As the wikipedia page for counting sort says, the real value is in sorting items by keys that are small integers, and the special case where the item is identical to the key isn't all that useful:

> In some descriptions of counting sort, the input to be sorted is assumed to be more simply a sequence of integers itself, but this simplification does not accommodate many applications of counting sort.

----------
nosy: +mark.dickinson

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45902>
_______________________________________


More information about the Python-bugs-list mailing list