if hasattr(item,"__iter__"): # Avoids iterating over strings
That's probably the cleanest way to avoid strings, but it's unfortunately not a good idea IMHO. Many objects (IndexedCatalog's Result objects are what I'm concerned about, but there are undoubtedly others) still rely entirely on the old-style sequence iteration protocol even though they're proper containers, so checking for __iter__ wouldn't work on them. Explicitly doing isinstance(item, basestring) is probably the best option until older objects move to the new iteration protocol.
--
http://mail.python.org/mailman/listinfo/python-list