Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python

Sorry about that, the Counter class is there.

 

 

Python python RSS feed   Index | Next | Previous | View Threaded


Scott.Daniels at Acm

Jul 10, 2009, 2:07 PM

Post #1 of 1 (226 views)
Permalink
Sorry about that, the Counter class is there.

Scott David Daniels wrote:
> Raymond Hettinger wrote:
>> [Scott David Daniels]
>>> def most_frequent(arr, N): ...
>> In Py2.4 and later, see heapq.nlargest().
> I should have remembered this one
>
>> In Py3.1, see collections.Counter(data).most_common(n)
> This one is from Py3.2, I think.

Oops -- egg all over my face. I thought I was checking with 3.1, and it
was 2.6.2. I _did_ make an explicit check, just poorly.

Again, apologies.

--Scott David Daniels
Scott.Daniels [at] Acm
--
http://mail.python.org/mailman/listinfo/python-list

Python python RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.