[Numpy-discussion] Re: np.where and ZeroDivisionError: float division by zero

2024-04-26 Thread rosko37
What you are hoping for here is known as "short circuit" or "lazy" evaluation. Namely, this would work if np.where(cond, x, y) only evaluates x if cond is true and only evaluates y if cond is false. In this case, not only can it handle situations where one of the true/false cases "breaks" one of th

[Numpy-discussion] Re: Function that searches arrays for the first element that satisfies a condition

2023-10-30 Thread rosko37
Oct 26, 2023 at 5:54 AM Dom Grigonis wrote: > Could you please give a concise example? I know you have provided one, but > it is engrained deep in verbose text and has some typos in it, which makes > hard to understand exactly what inputs should result in what output. > > Regards,

[Numpy-discussion] Function that searches arrays for the first element that satisfies a condition

2023-10-26 Thread rosko37
I know this question has been asked before, both on this list as well as several threads on Stack Overflow, etc. It's a common issue. I'm NOT asking for how to do this using existing Numpy functions (as that information can be found in any of those sources)--what I'm asking is whether Numpy would a