[docs] Typo in collections.Counter class example
qsolo825 at gmail.com
Wed Jun 5 19:16:18 CEST 2013
It seems that I found micro bug in Python documentation describing
There is the following snippet of code
c.most_common()[:-n:-1] # n least common elements
Actually this expression returns not *n* least common elements, but rather *n
- 1,* beacuse second boundary is not included (as usual with slices).
You probably meant c.most_common()[-n:] or c.most_common()[:-n-1:-1] if
reverse ordering is nesessary.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the docs