What does isinstance with a dictionary and abc.Mapping from collections doing?
<p>The code I'm running is:</p>

<pre><code>&gt;&gt;&gt; from collections import abc
&gt;&gt;&gt; mydict = {'test_key': 'test_value'}
&gt;&gt;&gt; isinstance(mydict, abc.Mapping)
True
</code></pre>

<p>I understand what <code>isinstance</code> does, but I'm not sure what <code>abc.Mapping</code> does from <code>collections</code>? </p>

<p>It seems like the line <code>isinstance(mydict, abc.Mapping)</code> is being used to check that <code>mydict</code> is a dictionary? </p>

<p>Wouldn't it just be easier to do
<code>isinstance(mydict, dict)</code>?</p>

<p>I did some searching and found related comments in this thread: <a href="https://stackoverflow.com/questions/378927/what-is-the-best-idiomatic-way-to-check-the-type-of-a-python-variable">What is the best (idiomatic) way to check the type of a Python variable?</a>, but I'm still having trouble figuring out why using <code>abc.Mapping</code> is preferable here than just using <code>dict</code>.</p>