Re: [Numpy-discussion] two questions about `choose`

2021-04-19 Thread Robert Kern
On Mon, Apr 19, 2021 at 12:24 PM bas van beek wrote: > After a taking a closer look at the `np.choose` docs I think we should > change `*choices: npt.ArrayLike` into `choices: Sequence[npt.ArrayLike]`.* > > > > *This would resolve the issue, but it’d also mean that directly passing an > array wil

Re: [Numpy-discussion] two questions about `choose`

2021-04-19 Thread bas van beek
-discussion] two questions about `choose` Oh. I answered thinking about choice and not choose. Please ignore both parts. On Sun, Apr 18, 2021, 17:56 Robert Kern mailto:robert.k...@gmail.com>> wrote: On Sat, Apr 17, 2021 at 4:28 PM Kevin Sheppard mailto:kevin.k.shepp...@gmail.com>>

Re: [Numpy-discussion] two questions about `choose`

2021-04-18 Thread Kevin Sheppard
Oh. I answered thinking about choice and not choose. Please ignore both parts. On Sun, Apr 18, 2021, 17:56 Robert Kern wrote: > On Sat, Apr 17, 2021 at 4:28 PM Kevin Sheppard > wrote: > >> 1. I suppose it only uses the (Native int or int64) dtype since each one >> would need a code path to run

Re: [Numpy-discussion] two questions about `choose`

2021-04-18 Thread Robert Kern
On Sat, Apr 17, 2021 at 4:28 PM Kevin Sheppard wrote: > 1. I suppose it only uses the (Native int or int64) dtype since each one > would need a code path to run quickly. > > 2. I would describe this a a bug. I think sequences are converted to > arrays and in this case the conversion is not return

Re: [Numpy-discussion] two questions about `choose`

2021-04-18 Thread Alan G. Isaac
I think you are saying that this current behavior of `choose` should be considered a bug. I hope not, because as illustrated, it is useful. How would you propose to efficiently do the same substitutions? On 4/17/2021 4:27 PM, Kevin Sheppard wrote: 2. I would describe this a a bug. I think sequen

Re: [Numpy-discussion] two questions about `choose`

2021-04-17 Thread Kevin Sheppard
1. I suppose it only uses the (Native int or int64) dtype since each one would need a code path to run quickly. 2. I would describe this a a bug. I think sequences are converted to arrays and in this case the conversion is not returning a 2 element object array but expanding and then concatenation

[Numpy-discussion] two questions about `choose`

2021-04-17 Thread Alan G. Isaac
1. Is there a technical reason for `choose` not accept a `dtype` argument? 2. Separately, mypy is unhappy with my 2nd argument to `choose`: Argument 2 to "choose" has incompatible type "Tuple[int, Sequence[float]]"; expected "Union[Union[int, float, complex, str, bytes, generic], Sequence[Union[i