Re: [Numpy-discussion] newbie question about boolean testing of array equality result

2011-03-23 Thread Jonathan Hartley
Thanks for the responses, folks. Robert, thanks for helping me come to terms with the situation, for pointing out the perils of comparing NaNs, and particularly for the "not isinstance(x, bool)" idea - some variant of this or attribute checking as you suggest sounds like what we'll use. Daniel

Re: [Numpy-discussion] newbie question about boolean testing of array equality result

2011-03-23 Thread Daniel Lepage
On Wed, Mar 23, 2011 at 10:29 AM, Jonathan Hartley wrote: > Hey people, > > I'm writing an application in which we evaluate user-supplied Python > expressions. > > Sometimes, we want to do an equality test on the result of the evaluation, > eg: > >     result = eval(...) >     if result == float('

Re: [Numpy-discussion] newbie question about boolean testing of array equality result

2011-03-23 Thread Robert Kern
On Wed, Mar 23, 2011 at 09:29, Jonathan Hartley wrote: > Hey people, > > I'm writing an application in which we evaluate user-supplied Python > expressions. > > Sometimes, we want to do an equality test on the result of the evaluation, > eg: > >     result = eval(...) >     if result == float('nan

[Numpy-discussion] newbie question about boolean testing of array equality result

2011-03-23 Thread Jonathan Hartley
Hey people, I'm writing an application in which we evaluate user-supplied Python expressions. Sometimes, we want to do an equality test on the result of the evaluation, eg: result = eval(...) if result == float('nan'): ... If the result is a numpy array, then this raises a