collections Counter most_common method

Mark Lawrence breamoreboy at yahoo.co.uk
Sat Dec 14 13:54:09 EST 2013


This method returns a list, the example from The Fine Docs being:-

 >>> Counter('abracadabra').most_common(3)
[('a', 5), ('r', 2), ('b', 2)]

With the trend in Python being more and more towards methods returning 
iterators, is there ever likely to be an imost_common method, or has 
this been suggested and rejected, or what?  I'm really just curious, but 
if enough people were to express an interest and it hasn't already been 
done, I'd happily raise an enhancement request on the bug tracker.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence




More information about the Python-list mailing list