Testing for a list
imbosol-1047325989 at aerojockey.com
Mon Mar 10 20:58:15 CET 2003
Steve Holden wrote:
> Secondly, there are a large number of circumstances in which it really isn't
> a good idead to be recognising the type of an object in such a hard-coded
> way. Do you really want to know it's a list, or do you simply need to be
> able to iterate over it, for example? If the latter, simply trying the
> iteration and catching any errors with a try/except might be a more
> sensiblke approach.
...which will fail miserably if the other possibile type of the object
is a string.
More information about the Python-list