> > counts = > > set(( item, mylist.count(item)) for item in mylist if mylist.count(item) > > Whee, this is great! I learned a lot today.
I should have added that although thats a one liner in code terms it does involve iterating over the list twice - in count() - for each element. So it might not be very fast for big lists, certainly there are more efficient solutions if you don't mind writing more code. But for most lists you will likely find it is fast enough, certainly for 18 items! Alan G. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor