<h3 dir="auto">Describe the issue:</h3>
<p dir="auto">Suppose we have an array whose total size is zero (product of <code class="notranslate">shape[i]</code> is zero) but the <code class="notranslate">shape != (0,)</code>. Below, I'm making one by slicing a non-empty array.</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; array = np.array([[1, 2, 3], [4, 5, 6]])
&gt;&gt;&gt; array
array([[1, 2, 3],
       [4, 5, 6]])
&gt;&gt;&gt; array.tolist()
[[1, 2, 3], [4, 5, 6]]
&gt;&gt;&gt; array[:, :0]
array([], shape=(2, 0), dtype=int64)
&gt;&gt;&gt; array[:, :0].tolist()
[[], []]"><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">array</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">array</span>([[<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>], [<span class="pl-c1">4</span>, <span class="pl-c1">5</span>, <span class="pl-c1">6</span>]])
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">array</span>
<span class="pl-en">array</span>([[<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>],
       [<span class="pl-c1">4</span>, <span class="pl-c1">5</span>, <span class="pl-c1">6</span>]])
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">array</span>.<span class="pl-en">tolist</span>()
[[<span class="pl-c1">1</span>, <span class="pl-c1">2</span>, <span class="pl-c1">3</span>], [<span class="pl-c1">4</span>, <span class="pl-c1">5</span>, <span class="pl-c1">6</span>]]
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">array</span>[:, :<span class="pl-c1">0</span>]
<span class="pl-en">array</span>([], <span class="pl-s1">shape</span><span class="pl-c1">=</span>(<span class="pl-c1">2</span>, <span class="pl-c1">0</span>), <span class="pl-s1">dtype</span><span class="pl-c1">=</span><span class="pl-s1">int64</span>)
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">array</span>[:, :<span class="pl-c1">0</span>].<span class="pl-en">tolist</span>()
[[], []]</pre></div>
<p dir="auto">The <code class="notranslate">repr</code> looks like <code class="notranslate">[]</code>, but I would expect it to be <code class="notranslate">[[], []]</code>, as the list representation is. This is minor, but I thought I'd point it out.</p>
<p dir="auto">I also didn't see anything like it in the current open issues.</p>
<h3 dir="auto">Reproduce the code example:</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="See above."><pre class="notranslate"><span class="pl-v">See</span> <span class="pl-s1">above</span>.</pre></div>
<h3 dir="auto">Error message:</h3>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="No error message."><pre class="notranslate">No error message.</pre></div>
<h3 dir="auto">NumPy/Python version information:</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; import sys, numpy; print(numpy.__version__, sys.version)
1.22.4 3.9.13 | packaged by conda-forge | (main, May 27 2022, 16:56:21) 
[GCC 10.3.0]"><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-k">import</span> <span class="pl-s1">sys</span>, <span class="pl-s1">numpy</span>; <span class="pl-en">print</span>(<span class="pl-s1">numpy</span>.<span class="pl-s1">__version__</span>, <span class="pl-s1">sys</span>.<span class="pl-s1">version</span>)
<span class="pl-c1">1.22</span>.<span class="pl-c1">4</span> <span class="pl-c1">3.9</span>.<span class="pl-c1">13</span> <span class="pl-c1">|</span> <span class="pl-s1">packaged</span> <span class="pl-s1">by</span> <span class="pl-s1">conda</span><span class="pl-c1">-</span><span class="pl-s1">forge</span> <span class="pl-c1">|</span> (<span class="pl-s1">main</span>, <span class="pl-v">May</span> <span class="pl-c1">27</span> <span class="pl-c1">2022</span>, <span class="pl-c1">16</span>:<span class="pl-c1">56</span>:<span class="pl-c1">21</span>) 
[<span class="pl-v">GCC</span> <span class="pl-c1">10.3</span><span class="pl-c1">.0</span>]</pre></div>
<h3 dir="auto">Reproducing code example:</h3>

<p dir="auto">Empty arrays repr like <code class="notranslate">array([], shape=(0, 0), dtype=float64)</code>, but this is not actually valid because <code class="notranslate">shape</code> cannot be passed to the array constructor:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; from numpy import *
&gt;&gt;&gt; empty((0, 0))
array([], shape=(0, 0), dtype=float64)
&gt;&gt;&gt; array([], shape=(0, 0), dtype=float64)
Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
TypeError: 'shape' is an invalid keyword argument for array()"><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-k">from</span> <span class="pl-s1">numpy</span> <span class="pl-k">import</span> <span class="pl-c1">*</span>
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-en">empty</span>((<span class="pl-c1">0</span>, <span class="pl-c1">0</span>))
<span class="pl-en">array</span>([], <span class="pl-s1">shape</span><span class="pl-c1">=</span>(<span class="pl-c1">0</span>, <span class="pl-c1">0</span>), <span class="pl-s1">dtype</span><span class="pl-c1">=</span><span class="pl-s1">float64</span>)
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-en">array</span>([], <span class="pl-s1">shape</span><span class="pl-c1">=</span>(<span class="pl-c1">0</span>, <span class="pl-c1">0</span>), <span class="pl-s1">dtype</span><span class="pl-c1">=</span><span class="pl-s1">float64</span>)
<span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>):
  <span class="pl-v">File</span> <span class="pl-s">"&lt;stdin&gt;"</span>, <span class="pl-s1">line</span> <span class="pl-c1">1</span>, <span class="pl-s1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>
<span class="pl-v">TypeError</span>: <span class="pl-s">'shape'</span> <span class="pl-c1">is</span> <span class="pl-s1">an</span> <span class="pl-s1">invalid</span> <span class="pl-s1">keyword</span> <span class="pl-s1">argument</span> <span class="pl-k">for</span> <span class="pl-en">array</span>()</pre></div>
<p dir="auto">It would be useful if either <code class="notranslate">array([], shape=(0, 0), dtype=float64)</code> worked or empty arrays printed to another string that actually did work, like <code class="notranslate">empty(shape=(0, 0), dtype=float64)</code>. Aside from copy-pastability being useful, it's very confusing that it shows the <code class="notranslate">shape</code> keyword like this when it doesn't actually exist.</p>

<h3 dir="auto">Error message:</h3>


<h3 dir="auto">Numpy/Python version information:</h3>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; np.__version__
'1.18.1'"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; np.__version__
'1.18.1'
</code></pre></div>