Performance problem with filtering

Skip Montanaro skip at pobox.com
Thu Mar 14 08:59:42 EST 2002


    gh>     def append(self, item):
    gh>         self.count[item] = self.count.get(item, 0) + 1
    gh>         self.l.append(item)

As I mentioned in my post, depending on the elements stored in the list you
may have to fiddle with "item" to make it dict-worthy.  Whether simply
slapping str() around it is sufficient, I don't know.  I sort of suspect
not, though it may get you closer to something that works for all types.

-- 
Skip Montanaro (skip at pobox.com - http://www.mojam.com/)




More information about the Python-list mailing list