<div dir="ltr"><div>The second argument is named `refcheck` rather than check_refs.<br><br></div>Eric<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 10, 2014 at 2:36 PM, Chris Barker <span dir="ltr"><<a href="mailto:chris.barker@noaa.gov" target="_blank">chris.barker@noaa.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Tue, Dec 9, 2014 at 11:03 PM, Sturla Molden <span dir="ltr"><<a href="mailto:sturla.molden@gmail.com" target="_blank">sturla.molden@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span>Nathaniel Smith <<a href="mailto:njs@pobox.com" target="_blank">njs@pobox.com</a>> wrote:<br>
<br>
> @contextmanager<br>
> def tmp_zeros(*args, **kwargs):<br>
>     arr = np.zeros(*args, **kwargs)<br>
>     try:<br>
>         yield arr<br>
>     finally:<br>
>         arr.resize((0,), check_refs=False)<br>
<br>
</span>That one is interesting. I have actually never used ndarray.resize(). It<br>
did not even occur to me that such an abomination existed :-)</blockquote><div><br></div></span><div> and I thought that it would only work if there were no other references to the array, in which case it gets garbage collected anyway, but I see the nifty check_refs keyword. However:</div><div><br></div><div><div>In [32]: arr = np.ones((100,100))</div><div><br></div><div>In [33]: arr.resize((0,), check_refs=False)</div><div>---------------------------------------------------------------------------</div><div>TypeError                                 Traceback (most recent call last)</div><div><ipython-input-33-f0e634534904> in <module>()</div><div>----> 1 arr.resize((0,), check_refs=False)</div><div><br></div><div>TypeError: 'check_refs' is an invalid keyword argument for this function</div></div><div><br></div><div><br></div><div><div>In [34]: np.__version__</div><div>Out[34]: '1.9.1'</div></div><div><br></div><div>Was that just added (or removed?)</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>-Chris</div><div><br></div></font></span></div><span class=""><div><br></div>-- <br><div><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R            <a href="tel:%28206%29%20526-6959" value="+12065266959" target="_blank">(206) 526-6959</a>   voice<br>7600 Sand Point Way NE   <a href="tel:%28206%29%20526-6329" value="+12065266329" target="_blank">(206) 526-6329</a>   fax<br>Seattle, WA  98115       <a href="tel:%28206%29%20526-6317" value="+12065266317" target="_blank">(206) 526-6317</a>   main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div>
</span></div></div>
<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></blockquote></div><br></div>