[Numpy-discussion] Re: dtype=(bool) vs dtype=bool

2021-10-19 Thread Robert Kern
On Tue, Oct 19, 2021 at 8:54 PM Hongyi Zhao wrote: > On Wed, Oct 20, 2021 at 8:29 AM Robert Kern wrote: > > > > On Tue, Oct 19, 2021 at 8:22 PM wrote: > >> > >> Do I have to use it this way? > > > > > > Nothing is forcing you to, but everyone else will write it as > `dtype=bool`, not `dtype=(bo

[Numpy-discussion] Re: dtype=(bool) vs dtype=bool

2021-10-19 Thread Hongyi Zhao
On Wed, Oct 20, 2021 at 8:29 AM Robert Kern wrote: > > On Tue, Oct 19, 2021 at 8:22 PM wrote: >> >> Do I have to use it this way? > > > Nothing is forcing you to, but everyone else will write it as `dtype=bool`, > not `dtype=(bool)`. `dtype=(bool)` is perfectly syntactically-valid Python. > It'

[Numpy-discussion] Re: dtype=(bool) vs dtype=bool

2021-10-19 Thread Robert Kern
On Tue, Oct 19, 2021 at 8:22 PM wrote: > Do I have to use it this way? > Nothing is forcing you to, but everyone else will write it as `dtype=bool`, not `dtype=(bool)`. `dtype=(bool)` is perfectly syntactically-valid Python. It's just not idiomatic, so readers of your code will wonder why you wr

[Numpy-discussion] Re: dtype=(bool) vs dtype=bool

2021-10-19 Thread hongyi . zhao
Do I have to use it this way? ___ 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...@ma

[Numpy-discussion] NumPy Development Meeting Wednesday - Triage Focus

2021-10-19 Thread Sebastian Berg
Hi all, Our bi-weekly triage-focused NumPy development meeting is Wednesday, October 20th at 16:30 UTC (9:30am Pacific Time). Everyone is invited to join in and edit the work-in-progress meeting topics and notes: https://hackmd.io/68i_JvOYQfy9ERiHgXMPvg I encourage everyone to notify us of issues

[Numpy-discussion] Re: dtype=(bool) vs dtype=bool

2021-10-19 Thread Mansour Moufid
On Tue, Oct 19, 2021 at 9:43 AM wrote: > > See the following testing in IPython shell: > > In [6]: import numpy as np > > In [7]: a = np.array([1], dtype=(bool)) > > In [8]: b = np.array([1], dtype=bool) > > In [9]: a > Out[9]: array([ True]) > > In [10]: b > Out[10]: array([ True]) > > It seems t

[Numpy-discussion] Re: dtype=(bool) vs dtype=bool

2021-10-19 Thread Andras Deak
On Tue, Oct 19, 2021 at 4:07 PM 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

[Numpy-discussion] Re: dtype=(bool) vs dtype=bool

2021-10-19 Thread Ryan Soklaski
As he said: this is not the appropriate use for this mailing list. On Tue, Oct 19, 2021, 10:05 AM 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: > > In [1]: import numpy as np > In [2]: from dis i

[Numpy-discussion] Re: dtype=(bool) vs dtype=bool

2021-10-19 Thread hongyi . zhao
> You could use `dis.dis` to compare the two expressions and see that they > compile to the same bytecode. Do you mean the following: In [1]: import numpy as np In [2]: from dis import dis In [7]: dis('bool') 1 0 LOAD_NAME0 (bool) 2 RETURN_VALUE In [8]:

[Numpy-discussion] Re: dtype=(bool) vs dtype=bool

2021-10-19 Thread Benjamin Root
(something) in python is only needed if you need to change the order of precedence or if you need to split something across 2 or more lines. Otherwise, it has no meaning and it is extraneous. On Tue, Oct 19, 2021 at 9:42 AM wrote: > See the following testing in IPython shell: > > In [6]: import

[Numpy-discussion] Re: dtype=(bool) vs dtype=bool

2021-10-19 Thread Andras Deak
On Tue, Oct 19, 2021 at 3:42 PM wrote: > See the following testing in IPython shell: > > In [6]: import numpy as np > > In [7]: a = np.array([1], dtype=(bool)) > > In [8]: b = np.array([1], dtype=bool) > > In [9]: a > Out[9]: array([ True]) > > In [10]: b > Out[10]: array([ True]) > > It seems th

[Numpy-discussion] dtype=(bool) vs dtype=bool

2021-10-19 Thread hongyi . zhao
See the following testing in IPython shell: In [6]: import numpy as np In [7]: a = np.array([1], dtype=(bool)) In [8]: b = np.array([1], dtype=bool) In [9]: a Out[9]: array([ True]) In [10]: b Out[10]: array([ True]) It seems that dtype=(bool) and dtype=bool are both correct usages. If so, wh

[Numpy-discussion] Re: Get a function definition/implementation hint similar to the one shown in pycharm.

2021-10-19 Thread Andras Deak
On Tue, Oct 19, 2021 at 7:26 AM wrote: > I've written the following python code snippet in pycharm: > ```python > import numpy as np > from numpy import pi, sin > > a = np.array([1], dtype=bool) > if np.in|vert(a) == ~a: > print('ok') > ``` > When putting the point/cursor in the above code snippe