[Michele Simionato] > Dunno, to me "tally" reads "counts the numbers of votes for a candidate > in an election".
That isn't a pleasant image ;-) >The > only right name would be "get_and_possibly_set" but it is a bit long to > type. > >> Even if a wording is found that better describes the both the get and >> set operation, it is still a distractor from the intent of the combined >> statement, the intent of building up a list. That is an intrinsic wording >> limitation that cannot be solved by a better name for setdefault. >> If any change is made at all, we ought to go the distance and provide a >> better designed tool rather than just a name change. > > Well, I never figured out that the intent of setdefault was to build up > a list ;) Right! What does have that intent is the full statement: d.setdefault(k, []).append(v). My thought is that setdefault() is rarely used by itself. Instead, it is typically part of a longer sentence whose intent and meaning is to accumulate or build-up. That meaning is not well expressed by the current idiom. Raymond Hettinger -- http://mail.python.org/mailman/listinfo/python-list