<div dir="ltr">Hello,<div><br></div><div>It seems that I found micro bug in Python documentation <a href="http://docs.python.org/3.3/library/collections.html#counter-objects">describing collections.Counter class</a>.</div>
<div style>There is the following snippet of code</div><div style><pre style="padding:5px;background-color:rgb(238,255,204);color:rgb(51,51,51);line-height:18px;border:1px solid rgb(170,204,153);font-size:15px;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px">
<font face="courier new, monospace"><span class="">c</span><span class="" style="color:rgb(102,102,102)">.</span><span class="">most_common</span><span class="">()[:</span><span class="" style="color:rgb(102,102,102)">-</span><span class="">n</span><span class="">:</span><span class="" style="color:rgb(102,102,102)">-</span><span class="" style="color:rgb(32,128,80)">1</span><span class="">]</span>         <span class="" style="color:rgb(64,128,144);font-style:italic"># n least common elements</span></font></pre>
</div><div style>Actually this expression returns not <i>n</i> least common elements, but rather <i>n - 1,</i> beacuse second boundary  is not included (as usual with slices).</div><div style>You probably meant <font face="courier new, monospace">c.most_common()[-n:]</font> or<font face="courier new, monospace"> c.most_common()[:-n-1:-1</font>] if reverse ordering is nesessary.</div>
<div> </div><div>-- <br>Best regards<br>Mikhail Golubev
</div></div>