[Numpy-discussion] numpy.filled, again

Alan G Isaac alan.isaac at gmail.com
Fri Jun 14 13:33:35 EDT 2013


> On 2013/06/14 5:15 AM, Alan G Isaac wrote:
>> But more important than the name I think
>> is allowing broadcasting of the values,
>> based on NumPy's broadcasting rules.
>> Broadcasting a scalar is then a special case,
>> even if it is the case that has dominated this thread.


On 6/14/2013 1:18 PM, Eric Firing wrote:
> All of this fuss is about replacing two lines of user code
> with a single line.  If it can't be kept simple, both in
> implementation and in documentation, it shouldn't be done
> at all.


Here's another perspective: if that's all we get
(one line instead of two), it isn't worth it at all.
But if we get something more useful (broadcast of values),
it might be worthwhile.

But hmm, once we go there, wouldn't the right thing to do
be to just make sure ``tile`` is efficient and add
a dtype argument?  We already have

>>> np.tile(0.5,(2,3))
array([[ 0.5,  0.5,  0.5],
        [ 0.5,  0.5,  0.5]])

Cheers,
Alan




More information about the NumPy-Discussion mailing list