[Numpy-discussion] Unexpected warnings in where

Perry Greenfield perry at stsci.edu
Thu May 13 10:00:02 CDT 2004

Álvaro Tejero Cantero wrote:
> > I think what you're seeing is this:
> >
> > where(condition, expression1, expression2)
> >
> > Even though condition is selecting parts of expression1 which are valid,
> > expression1 is still fully evaluated.
> Is this behaviour what is intended, or do you consider it a shortcoming
> of the implementation?. In theory avoiding unneeded evaluations of
> expression1 is very desirable...
It's about the only way it could work given how an array-based
library works (unless there were a mechanism to postpone
evaluation of expressions until their context can be
determined). The expression is evaluated before it is passed to the
where function.

Perry Greenfield

More information about the Numpy-discussion mailing list