"jeethu_rao" <[EMAIL PROTECTED]> wrote: > Adding to George's reply, if you want slightly more performance, you > can avoid the exception with something like > > def hist(seq): > h = {} > for i in seq: > h[i] = h.get(i,0)+1 > return h.items() > > Jeethu Rao
The performance penalty of the exception is imposed only the first time a distinct item is found. So unless you have a huge list of distinct items, I seriously doubt that this is faster at any measurable rate. George -- http://mail.python.org/mailman/listinfo/python-list