title: (cannot find) python countable attribute most_common()
body: <p>novice here. I'm walking myself through the nltk book and another Python intro book.
  I came across most_common() earlier on in the nltk book, and though I couldn't have it working nor find a solution at the time, I created a little function that did the trick in that particular exercise and kept going. 
  Now I need it again, but I don't think I'll be able to get around it as easily (the exercise is about the most common word lengths in a particular text), plus I know I will find it again in later examples, and I'd like to be able to follow, since, as I said, I'm a novice.</p>
  
  <p>In theory, I should be able to do this:</p>
  
  <pre><code>fdist = FreqDist(len(w) for w in text1)
  
  fdist.most_common()
  [(3, 50223), (1, 47933), (4, 42345), (2, 38513) ...
  </code></pre>
  
  <p>However, Python tells me this:</p>
  
  <pre><code>AttributeError: 'FreqDist' object has no attribute 'most_common'
  </code></pre>
  
  <p>I found that most_common() is an attribute of counter objects (<a href="http://docs.python.org/2/library/collections.html">http://docs.python.org/2/library/collections.html</a>) and (<a href="http://docs.python.org/dev/library/collections#collections.Counter">http://docs.python.org/dev/library/collections#collections.Counter</a>). I get the idea that perhaps I should be importing something (a module?), but what I have tried importing either doesn't work (not defined or non-existent messages) or does not contain it -I tried </p>
  
  <pre><code>import collections 
  </code></pre>
  
  <p>no error there, but most_common() is not listed when I enter dir(collections) or dir(<em>builtins</em>).</p>
  
  <p>I have both 2.7 and 3.0 installed (windows most of the time, occasionally working in my virtual machine with ubuntu). I will keep searching, but will greatly appreciate your input. This feels kind of basic but I'm learning and can't make it out myself at least for now.
  Again, thanks a lot.</p>