How to do type verification in python?
<p>(Maybe b/c I'm from a C++ world)
I want to verify some python variable is</p>

<p><code>list(string)</code> or <code>list(dict(int, string))</code> or <code>SomethingIterable(string)</code></p>

<p>Is there a simple and unified way to do it?
(Instead of writing customized code to iterate and verify each instance..)</p>

<p>I emphasize that I understand in Python <code>list</code> can have elements of different types, which is exactly the reason why I ask how to verify a <code>list</code> which are composed by just a certain type e.g. <code>string</code>.</p>

<p>In Python lists can be composed of mixed types, there is no way to do something like setting the "type" of a list. Also, even if you could, this "type" is not enforced and could change at any time.</p>

python