<p dir="auto">In python -True should be -1 and not False as in your own bool implementation!</p>
<p dir="auto">NumPy behavior is inconsistent with that of python builtins:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; -numpy.array(True)
False
&gt;&gt;&gt; -numpy.bool8(True)
False"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; -numpy.array(True)
False
&gt;&gt;&gt; -numpy.bool8(True)
False
</code></pre></div>
<p dir="auto">but</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; -True
-1"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; -True
-1
</code></pre></div>