Top-rated recipes tagged "isinstance"http://code.activestate.com/recipes/tags/isinstance/top/2012-07-26T18:09:30-07:00ActiveState Code RecipesAll [iter] is Instance of [class/type/tuple] (Python)
2012-07-26T18:09:30-07:00Jonathan Frerehttp://code.activestate.com/recipes/users/4182985/http://code.activestate.com/recipes/578226-all-iter-is-instance-of-classtypetuple/
<p style="color: grey">
Python
recipe 578226
by <a href="/recipes/users/4182985/">Jonathan Frere</a>
(<a href="/recipes/tags/function/">function</a>, <a href="/recipes/tags/instance/">instance</a>, <a href="/recipes/tags/isinstance/">isinstance</a>).
Revision 2.
</p>
<p>So it turned out that I needed a way of ensuring that all members of an iterable are instances of a certain class. Here, therefore, is the <code>isallinstance()</code> function.</p>