I just came across a problem with the intention to specify unset
boundaries given to numpy.clip() or array.clip():

a.clip(1e-10, None)
a.clip(None, -1e-10)

When doing this, the returned array is dtype=numpy.object, seemingly
None gets converted to a numpy.asarray(None, dtype=numpy.object), and
this is then used for the comparison.  Since (*any number* > None) is
true, and (*any number* < None) is false, it works or not, depending
on the usecase, despite one is still left with a dtype=numpy.object
array.  Precisely, using None as the lower boundary semi-works, while
using None as the upper boundary doesn't match expectations at all.

One can work around this, sure, but in my opinion it would be handy
anyway to have clip() interpret None as argument as \pm \infty.  Maybe
I'm just missing the appropriate function, though.

Friedrich
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to