Nathaniel Smith <n...@pobox.com> wrote:

> This should be pretty trivial to implement. AFAICT you don't need any
> complicated cython

I have a bad habit of thinking in terms of too complicated C instead of
just using NumPy.


> @contextmanager
> def tmp_zeros(*args, **kwargs):
>     arr = np.zeros(*args, **kwargs)
>     try:
>         yield arr
>     finally:
>         arr.resize((0,), check_refs=False)
> 
> Given how intrinsically dangerous this is, and how easily it can be
> implemented using numpy's existing public API, I think maybe we should
> leave this for third-party daredevils instead of implementing it in numpy
> proper.

It seems so :-)


Sturla

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

Reply via email to