[Numpy-discussion] Initializing an array to a constant value
Mon Feb 13 16:19:31 CST 2012
Le 13/02/2012 19:17, eat a écrit :
> wouldn't it be nice if you could just write:
> a= np.empty(shape).fill(A)
> this would be possible if .fill(.) just returned self.
Thanks for the tip. I noticed several times this was not working
(because of course, in the mean time, I forgot it...)
but I had totally overlooked the reasons (just imagining there was some
garbage collection magic vanishing my arrays !!)
I find the syntax "np.empty(shape).fill(A)" being indeed a good
alternative to the burden of creating a new numpy.fill (or numpy.filled
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion