<div dir="ltr">On Wed, May 29, 2013 at 10:24 PM, Andrew Barnert <span dir="ltr"><<a href="mailto:abarnert@yahoo.com" target="_blank">abarnert@yahoo.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div class="im"><div>On May 29, 2013, at 20:31, David Mertz <<a href="mailto:mertz@gnosis.cx" target="_blank">mertz@gnosis.cx</a>> wrote:</div>
<blockquote type="cite"><div><div dir="ltr"><div><div><div><div>Well... I actually *did* implement it a few notes up-thread, it's not merely simple, but actual.</div></div></div></div></div></div></blockquote></div>I think I'd use numbers.Integral and collections.abc.Mapping rather than int and Counter. And maybe take any Container as a counter with the value 1 for each key, given that Counter is intended to work as a multiset.</div>
</blockquote><div><br></div><div>It all still seems somewhat silly to me since the use-case eludes me.  But...<br><br></div><div>You are right about numbers.Integral, that is a better isinstance() test.  However, I don't think so with collections.abc.Mapping--in that case I deliberately chose collections.Counter because the semantics seemed undefined in other cases.<br>
<br></div><div>That is, I have no idea what meaning the OP would assign to:<br><br></div><div>>>> Counter({'a':1,'b':2}) * OrderedDict((('a','x'),('b','y')))<br><br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>Also, I think the one-liner dict comprehension implementation is simpler than the explicit loop around setitem.</div>
</div></blockquote><div><br></div><div>Yeah, that's probably simpler.  Maybe less explicit, but the code is so short in any case.<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="auto">And I think if you have mult you'll probably want imult as well. </div></blockquote><div><br></div><div>Maybe.  It wasn't in the original "spec" so who knows.  But that's straightforward also, of course.<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>But bikeshedding aside, your implementation should be more than enough for the OP.</div>
</div></blockquote><div><br></div><div>That's my sense. <br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>Well, given that it will be in a separate module if the OP puts it on PyPI, I don't see any downside to giving it the same name.</div>
</div></blockquote><div><br></div><div>Fair enough. <br></div><br>
</div></div></div>