> What you are hoping for here is known as "short circuit" or "lazy" evaluation.
In SciPy, we have the private utility function `_lazywhere`[1] for this.
Cheers,
Lucas
[1]
https://github.com/scipy/scipy/blob/f44326023dc51758495491fc9f06858fd38358a0/scipy/_lib/_util.py#L88-L156
> On 26 Apr 2024
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
The function np.where just chooses elements from two arrays that are both
computed before np.where is even executed. See this StackOverflow answer
https://stackoverflow.com/a/29950752/4681187 if you want to suppress the
error.
On Thu, Apr 25, 2024 at 8:16 PM 840362492--- via NumPy-Discussion <
num