On Tue, Oct 19, 2021 at 4:07 PM <hongyi.z...@gmail.com> 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 -- numpy-discussion@python.org > To unsubscribe send an email to numpy-discussion-le...@python.org > https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ > Member address: deak.and...@gmail.com >
_______________________________________________ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-le...@python.org https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ Member address: arch...@mail-archive.com