Reinhold Birkenfeld wrote:
Peter Hansen wrote:
+1 for add and, given the above, I'm unsure there's
a viable alternative (unless this is restricted to
positive values, or perhaps even to "+1" specifically).

What about `addto()'? add() just has the connotation of adding something to the dict and not to an item in it.

Hmm... better than add anyway. I take back my ill-considered +1 above, and apply instead a +0 to "count". I don't actually like any of the alternatives at this point... needs more thought (for my part, anyway).

To be honest, the only time I've ever seen this particular
idiom is in tutorial code or examples of how you produce
a histogram of word usage in a text document.  Never in real
code (not that it doesn't happen, just that I've never
stumbled across it).  The "appending to a list" idiom, on
the other hand, I've seen and used quite often.

I'm just going to stay out of the "add/inc/count/addto"
debate and consider the other half of the thread now. :-)

-Peter
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to