<p dir="ltr">So this petered off...any objections to np.full?</p>
<div class="gmail_quote">On 29 Jun 2013 05:03,  <<a href="mailto:josef.pktd@gmail.com">josef.pktd@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Wed, Jun 12, 2013 at 8:10 AM, Nathaniel Smith <<a href="mailto:njs@pobox.com">njs@pobox.com</a>> wrote:<br>
> Hi all,<br>
><br>
> It looks like we've gotten a bit confused and need to untangle<br>
> something. There's a PR to add new functions 'np.filled' and<br>
> 'np.filled_like':<br>
>   <a href="https://github.com/numpy/numpy/pull/2875" target="_blank">https://github.com/numpy/numpy/pull/2875</a><br>
> And there was a discussion about this on the list back in January:<br>
>   <a href="http://thread.gmane.org/gmane.comp.python.numeric.general/52763" target="_blank">http://thread.gmane.org/gmane.comp.python.numeric.general/52763</a><br>
><br>
> I think a reasonable summary of the opinions in the thread are:<br>
> - This functionality is great, ...<br>
> - ...but we can't call it 'np.filled' because there's also<br>
> 'np.ma.filled' which does something else...<br>
> - ...but there really aren't any better names...<br>
> - ...so we should overload np.empty, like: 'np.empty(shape, fill=value)'<br>
><br>
> In the mean time the original submitter has continued puttering along<br>
> polishing the original patch, and it's ready to merge... except it's<br>
> still the original interface, somehow the thread discussion and the PR<br>
> discussion never met up.<br>
><br>
> So, we have to decide what to do.<br>
><br>
> Personally I think that overloading np.empty is horribly ugly, will<br>
> continue confusing newbies and everyone else indefinitely, and I'm<br>
> 100% convinced that we'll regret implementing such a warty interface<br>
> for something that should be so idiomatic. (Unfortunately I got busy<br>
> and didn't actually say this in the previous thread though.) So I<br>
> think we should just merge the PR as is. The only downside is the<br>
> <a href="http://np.ma" target="_blank">np.ma</a> inconsistency, but, <a href="http://np.ma" target="_blank">np.ma</a> is already inconsistent (cf.<br>
> masked_array.fill versus masked_array.filled!), somewhat deprecated,<br>
> and AFAICT there are far more people who will benefit from a clean<br>
> np.filled idiom than who actually use <a href="http://np.ma" target="_blank">np.ma</a> (and in particular its<br>
> fill-value functionality). So there would be two<br>
> bad-but-IMHO-acceptable options: either live with an inconsistency<br>
> between np.filled and np.ma.filled, or deprecate np.ma.filled in favor<br>
> of masked_array.filled (which does exactly the same thing) and<br>
> eventually switch np.ma.filled to be consistent with the new<br>
> np.filled.<br>
><br>
> But, that's just my opinion.<br>
><br>
> -n<br>
> _______________________________________________<br>
> NumPy-Discussion mailing list<br>
> <a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
> <a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
<br>
<br>
Why we need this animal whatever it is called<br>
<br>
 Scientific Python @SciPyTip<br>
Create a 2x3 array filled with integer 7's: 7*np.ones((2,3), int)<br>
<br>
and I just did this yesterday,  np.nan * np.ones(3)<br>
maybe I should have used np.zeros(3) / 0.<br>
<br>
Josef<br>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
</blockquote></div>