title: How to check the values in two dictionaries have the same type?
body: <p>For example, I have two dictionaries having the same keys:</p>
  <pre><code>a = {&quot;a&quot;: 1, &quot;b&quot;: 2, &quot;c&quot;:4.5, &quot;d&quot;:[1,2], &quot;e&quot;:&quot;string&quot;, &quot;f&quot;:{&quot;f1&quot;:0.0, &quot;f2&quot;:1.5}}
  b = {&quot;a&quot;: 10, &quot;b&quot;: 20, &quot;c&quot;:3.5, &quot;d&quot;:[0,2,4], &quot;e&quot;:&quot;q&quot;, &quot;f&quot;:{&quot;f1&quot;:1.0, &quot;f2&quot;:0.0}}
  </code></pre>
  <p>and I want to compare the types. My code is something like this:</p>
  <pre><code>if type(a[&quot;a&quot;]) ==  type(b[&quot;a&quot;]) and type(a[&quot;b&quot;]) == type(b[&quot;b&quot;]) and type(a[&quot;c&quot;]) == type(b[&quot;c&quot;]) and type(a[&quot;d&quot;]) == type(b[&quot;d&quot;]) and type(a[&quot;e&quot;]) == type(b[&quot;e&quot;]) and type(a[&quot;f&quot;]) == type(b[&quot;f&quot;]) and type(a[&quot;f&quot;][&quot;f1&quot;]) == type(b[&quot;f&quot;][&quot;f1&quot;]) and type(a[&quot;f&quot;][&quot;f2&quot;]) == type(b[&quot;f&quot;][&quot;f2&quot;]):
      first_type = type(b[&quot;d&quot;][0])
      if all( (type(x) is first_type) for x in a[&quot;d&quot;] )
         #do something
         pass
  </code></pre>
  <p>Is there a better way to do it?</p>