On Tue, Dec 9, 2014 at 11:03 PM, Sturla Molden <sturla.mol...@gmail.com>
wrote:

> Nathaniel Smith <n...@pobox.com> wrote:
>
> > @contextmanager
> > def tmp_zeros(*args, **kwargs):
> >     arr = np.zeros(*args, **kwargs)
> >     try:
> >         yield arr
> >     finally:
> >         arr.resize((0,), check_refs=False)
>
> That one is interesting. I have actually never used ndarray.resize(). It
> did not even occur to me that such an abomination existed :-)


 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:

In [32]: arr = np.ones((100,100))

In [33]: arr.resize((0,), check_refs=False)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-33-f0e634534904> in <module>()
----> 1 arr.resize((0,), check_refs=False)

TypeError: 'check_refs' is an invalid keyword argument for this function


In [34]: np.__version__
Out[34]: '1.9.1'

Was that just added (or removed?)

-Chris


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

chris.bar...@noaa.gov
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to