I'm pretty sure that that way would require multiple passes through the sequence. I made a modification to this function which now allows the frequencies to be computed in a single pass, so I think that's better. It's unfortunate that ``collections.Counter`` doesn't let you specify the count (it's always 1, afaik).