On Tue, Oct 19, 2021 at 4:07 PM <[email protected]> wrote:

> > You could use `dis.dis` to compare the two expressions and see that they
> compile to the same bytecode.
>
> Do you mean the following:
>

Indeed, that is exactly what I meant. You don't even need the numpy import
for that. Since `bool` and `(bool)` are compiled to the same bytecode,
numpy isn't even aware that you put parentheses around `bool` in your code.



> In [1]: import numpy as np
> In [2]: from dis import dis
> In [7]: dis('bool')
>   1           0 LOAD_NAME                0 (bool)
>               2 RETURN_VALUE
>
> In [8]: dis('(bool)')
>   1           0 LOAD_NAME                0 (bool)
>               2 RETURN_VALUE
> _______________________________________________
> NumPy-Discussion mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
> Member address: [email protected]
>
_______________________________________________
NumPy-Discussion mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: [email protected]

Reply via email to