Testing for a list

Mark McEahern marklists at mceahern.com
Mon Mar 10 14:09:08 EST 2003


[Antun Karlovac [mailto:antun at antunkarlovac.com]]
> That's exactly what I needed.
>
> Why were people ignoring my question? What was wrong about it?

If you use explicit type checking (if type(a) == type(list)), that means
your test will fail to treat as sequence-ish other things that might also be
sequence-ish (e.g., a tuple, a user defined type that implements the
sequence methods, etc.).

For what it's worth, your question is a FAQ.

// m

-






More information about the Python-list mailing list