title: How do I define a structure instance in numpy?
body: <p>I have a numpy data type defined like this for example:</p>
  <pre><code>import numpy as np
  
  Mytype = np.dtype([
      ('x': np.float32), 
      ('y': np.float32), 
      ('flag': np.uint8)
  ], align=True)
  </code></pre>
  <p>So what is the simplest way to create an instance (numpy tuple) according to this type?</p>
  <p>I tried this:</p>
  <pre><code>instance = Mytype(x=2.4, y=5.3, flag=12)
  </code></pre>
  <p>That led to the error: <code>TypeError: 'numpy.dtype[void]' object is not callable</code></p>
  <p>I looked at the examples here: <a href="https://numpy.org/doc/stable/user/basics.rec.html" rel="nofollow noreferrer">https://numpy.org/doc/stable/user/basics.rec.html</a> but I have not found a solution for <strong>exactly one instance</strong>. All suggested cases are for arrays only. So I could do this:</p>
  <pre><code>instance = np.array([(2.4, 5.3, 12)], dtype=Mytype)[0]
  </code></pre>
  <p>It works correct but it looks too complicated. I guess there is an easier way without creation of an extra array.</p>