Hi All-- Raymond Hettinger wrote: > > Separating the two cases is essential. Also, the wording should contain > strong > cues that remind you of addition and of building a list. > > For the first, how about addup(): > > d = {} > for word in text.split(): > d.addup(word) >
I still prefer tally(), despite perceived political connotations. They're only connotations, after all, and tally() comprises both positive and negative incrementing, whereas add() and addup() will tease users into thinking they are only for incrementing. What about adding another method, "setincrement()"? d={} d.setincrement(-1) for word in text.split(): d.tally(word,1) if word.lower() in ["a","an","the"]: d.tally(word) Not that there's any real utility in that. Metta, Ivan ---------------------------------------------- Ivan Van Laningham God N Locomotive Works http://www.pauahtun.org/ http://www.andi-holmes.com/ Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours -- http://mail.python.org/mailman/listinfo/python-list