<div dir="ltr"><div><div><div><div><div><br>Phil,<br><br></div>Nice work on this.  Thank you for putting this together and sharing it with everyone.  <br><br>I didn't get to attend your presentation, but I do have a couple thoughts to share.  <br><br>First, I like the idea of speeding up the top ten method, but the implementation isn't quite correct in all cases.  Consider passing a sequence to your function in sorted descending order.  The curMin equals to the maximum value on the first iteration of the series and only one item will be return from your deque.  Also, renaming curMin to curMax would be more clear.<br><br></div><div>For a better implementation, we can look at the collections source code ( <a href="https://hg.python.org/cpython/file/2.7/Lib/collections.py">https://hg.python.org/cpython/file/2.7/Lib/collections.py</a> line 484 ). The Counter class has a most_common method implemented, and it does exactly what we want.  Here the method defaults to the sorted method you shared when "n" is not passed.  Of course this runs O(n log n) as it does a complete sort.  However, when n is provided, the algorithm switches to a sorted heap which is faster when we only want a specific number of items ( O(k log n),  n := heap size, k := items requested from the heap ).<br><br></div><div>One other thought on the Counter class.  The constructor does take an <span id="l464"><span class="">iterable, so if you want you could pass your csv reader or a generator directly to the Counter during the initialization.  <br><br></span></span></div>If any of this was discussed at the meeting, I apologize for the repeat but hope others will benefit from the discussion.  <br><br></div>Again thanks for putting this together.  You made me think about these structures more and made me look at python source code.  <br><br></div>Best,<br><br></div>Aaron<br><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 31, 2016 at 7:11 PM, Joshua Herman <span dir="ltr"><<a href="mailto:zitterbewegung@gmail.com" target="_blank">zitterbewegung@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yes it was a very interesting and easy to understand what you were talking about great presentation. Also good practical examples.<div class="HOEnZb"><div class="h5"><br><div class="gmail_quote"><div dir="ltr">On Tue, May 31, 2016 at 6:23 PM Michael Tamillow <<a href="mailto:mikaeltamillow96@gmail.com" target="_blank">mikaeltamillow96@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yeah, I second what Bob said. You kicked as+<br>
<br>
Sent from my iPhone<br>
<br>
> On May 31, 2016, at 6:18 PM, Bob Haugen <<a href="mailto:bob.haugen@gmail.com" target="_blank">bob.haugen@gmail.com</a>> wrote:<br>
><br>
> That's really educational for a self-taught sloppy python programmer.<br>
> Thank you very much.<br>
><br>
> On Tue, May 31, 2016 at 6:13 PM, Robare, Phillip (TEKSystems)<br>
> <<a href="mailto:proba@allstate.com" target="_blank">proba@allstate.com</a>> wrote:<br>
>> I have put the files from my May 12th meeting talk on the Collections module up on github: <a href="https://github.com/verisimilidude/TheCollectionsModule" rel="noreferrer" target="_blank">https://github.com/verisimilidude/TheCollectionsModule</a><br>
>><br>
>> The one exception is the data file I used, the City of Chicago's building permits data.  I have a file in the archive about how to download that data.<br>
>><br>
>> Phil Robare<br>
>> TEK Systems / Allstate QR&A<br>
>> <a href="tel:847-667-0431" value="+18476670431" target="_blank">847-667-0431</a><br>
>> D2W-722D<br>
>><br>
>><br>
>> _______________________________________________<br>
>> Chicago mailing list<br>
>> <a href="mailto:Chicago@python.org" target="_blank">Chicago@python.org</a><br>
>> <a href="https://mail.python.org/mailman/listinfo/chicago" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/chicago</a><br>
> _______________________________________________<br>
> Chicago mailing list<br>
> <a href="mailto:Chicago@python.org" target="_blank">Chicago@python.org</a><br>
> <a href="https://mail.python.org/mailman/listinfo/chicago" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/chicago</a><br>
_______________________________________________<br>
Chicago mailing list<br>
<a href="mailto:Chicago@python.org" target="_blank">Chicago@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/chicago" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/chicago</a><br>
</blockquote></div>
</div></div><br>_______________________________________________<br>
Chicago mailing list<br>
<a href="mailto:Chicago@python.org">Chicago@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/chicago" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/chicago</a><br>
<br></blockquote></div><br></div></div></div></div>