disgrating a list

Tal Einat tal.no.no.spam at gmail.com
Fri Sep 1 20:26:24 CEST 2006

Tim Chase wrote:
> I'm not sure if '__iter__' is the right thing to be looking for,
> but it seems to work at least for lists, sets, dictionarys (via
> their keys), etc.  I would use it because at least then you know
> you can iterate over it

AFAIK and as seen throughout posts on c.l.py, the best way to check if
something is iterable is:

except TypeError:
    <obj is not iterable>
    <obj is iterable>

- Tal

More information about the Python-list mailing list