title: How do I compare two large 2D arrays in Python for exact equality?
body: <p>As stated in the title. I am trying to compare two large(21x21) grids containing elments of single dots and single dashes to see if each element at each index is the same. Using <code>array1 == array2</code> produces the following error:</p>
  <pre><code>The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
  </code></pre>
  <p>However, I have not encountered a good explanation of the a.all/a.any syntax. What goes before the dot? What params do they take?</p>
  <p>Edit: I have been avoiding using NumPy, but theres no way around it. NumPy is imported.
  Any ideas?</p>
  <p>Portion of the code where I am creating a default grid of dots and dashes:</p>
  <pre><code>defaultgrid = [['.' for x in range(width)] for y in range(height)]
  
  for x in range(1, 21, 2):
      defaultgrid[x] = [&quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;, &quot; &quot;,
                        &quot; &quot;, &quot; &quot;]
  
  for x in range(0, 21, 2):
      defaultgrid[x] = [&quot;.&quot;, &quot; &quot;, &quot;.&quot;, &quot; &quot;, &quot;.&quot;, &quot; &quot;, &quot;.&quot;, &quot; &quot;, &quot;.&quot;, &quot; &quot;, &quot;.&quot;, &quot; &quot;, &quot;.&quot;, &quot; &quot;, &quot;.&quot;, &quot; &quot;, &quot;.&quot;, &quot; &quot;, &quot;.&quot;,
                        &quot; &quot;, &quot;.&quot;]
  </code></pre>