<p dir="auto">When accessing multiple fields of a structured array, numpy fails to verify that all the fields exist.  Instead, it will only return existing fields.  If none exist, it return a strange object that has a dtype that is empty.  Normally, creating an object with an empty dtype is not supposed to be possible (<code class="notranslate">zeros(shape=(5,), dtype=[])</code> results as expected in <code class="notranslate">TypeError: Empty data-type</code>), so this might actually be a dual bug.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [216]: A = numpy.empty(dtype=[(&quot;A&quot;, &quot;f4&quot;), (&quot;B&quot;, &quot;f8&quot;)], shape=(5,))

In [217]: A[[&quot;AA&quot;]]
Out[217]: 
array([(), (), (), (), ()], 
      dtype='{'names':[], 'formats':[], 'offsets':[], 'itemsize':12}')

In [232]: A[[&quot;AA&quot;, &quot;B&quot;]]
Out[232]: 
array([(0.0,), (0.0,), (0.0,), (0.0,), (0.0,)], 
      dtype=[('B', '&lt;f8')])"><pre class="notranslate"><code class="notranslate">In [216]: A = numpy.empty(dtype=[("A", "f4"), ("B", "f8")], shape=(5,))

In [217]: A[["AA"]]
Out[217]: 
array([(), (), (), (), ()], 
      dtype='{'names':[], 'formats':[], 'offsets':[], 'itemsize':12}')

In [232]: A[["AA", "B"]]
Out[232]: 
array([(0.0,), (0.0,), (0.0,), (0.0,), (0.0,)], 
      dtype=[('B', '&lt;f8')])
</code></pre></div>
<p dir="auto">When accessing multiple records with <code class="notranslate">arr[["field0", "field1",…]]</code>, using a non-existing field is silent:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; arr = numpy.array([(1, 2, 10), (3, 4, 10)], dtype=[('x', int), ('y', int), (&quot;z&quot;, int)])
&gt;&gt;&gt; arr[[&quot;lkjlkj&quot;]]
array([(), ()], 
      dtype='{'names':[], 'formats':[], 'offsets':[], 'itemsize':24}')"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; arr = numpy.array([(1, 2, 10), (3, 4, 10)], dtype=[('x', int), ('y', int), ("z", int)])
&gt;&gt;&gt; arr[["lkjlkj"]]
array([(), ()], 
      dtype='{'names':[], 'formats':[], 'offsets':[], 'itemsize':24}')
</code></pre></div>
<p dir="auto">This is inconsistent with accessing a single field:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; arr[&quot;lkjlkj&quot;]
Traceback (most recent call last):
  File &quot;&lt;ipython-input-7-7a431ec24c6c&gt;&quot;, line 1, in &lt;module&gt;
    arr[&quot;lkjlkj&quot;]
ValueError: field named lkjlkj not found"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; arr["lkjlkj"]
Traceback (most recent call last):
  File "&lt;ipython-input-7-7a431ec24c6c&gt;", line 1, in &lt;module&gt;
    arr["lkjlkj"]
ValueError: field named lkjlkj not found
</code></pre></div>
<p dir="auto">Furthermore, it creates error messages that can be harder to make sense of, like in:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="for (x, y_value) in arr[[&quot;x&quot;, &quot;y_valuf&quot;]]:  # Note the typo in &quot;y_valuf&quot;
    …"><pre class="notranslate"><code class="notranslate">for (x, y_value) in arr[["x", "y_valuf"]]:  # Note the typo in "y_valuf"
    …
</code></pre></div>
<p dir="auto">(ValueError: need more than 1 value to unpack).</p>
<p dir="auto">I can't find any documentation on the current behavior either (it's not in <a href="http://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#record-access" rel="nofollow">http://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#record-access</a>).</p>
<p dir="auto">I would suggest that non-existing fields raise an exception, for consistency/least-surprise and practicality reasons.</p>