Keith Goodman wrote: > Yeah, I do stuff like that too. fill works in place so it returns None. > > >>> x = np.array([1,2]) >>> x.fill(10) >>> x >>> > array([10, 10]) > >>> x = x.fill(10) # <-- Danger! >>> print x >>> > None > Since result "None" is never used it would be better to return reference to the modified array, it would decrease number of bugs. The last expression can raise very seldom in untested cases, I have revealed one of this recently in my code:
if some_seldom_cond: r = empty(n, bool).fill(True) else: r = None So, as you see, r was always None D. _______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
