[Numpy-discussion] isn't it a bug in array.fill()?
Fri Aug 29 12:42:01 CDT 2008
Keith Goodman wrote:
> Yeah, I do stuff like that too. fill works in place so it returns None.
>>> x = np.array([1,2])
> array([10, 10])
>>> x = x.fill(10) # <-- Danger!
>>> print x
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:
r = empty(n, bool).fill(True)
r = None
So, as you see, r was always None
More information about the Numpy-discussion