[Numpy-discussion] Context manager for seterr

2014-12-14 Thread Stefan van der Walt
Hi all, Since the topic of context managers recently came up, what do you think of adding a context manager for seterr? with np.seterr(divide='ignore'): frac = num / denom Stéfan ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] Context manager for seterr

2014-12-14 Thread Julian Taylor
On 15.12.2014 01:12, Stefan van der Walt wrote: Hi all, Since the topic of context managers recently came up, what do you think of adding a context manager for seterr? with np.seterr(divide='ignore'): frac = num / denom already exists as np.errstate: with

Re: [Numpy-discussion] Context manager for seterr

2014-12-14 Thread Pauli Virtanen
15.12.2014, 02:12, Stefan van der Walt kirjoitti: Since the topic of context managers recently came up, what do you think of adding a context manager for seterr? with np.seterr(divide='ignore'): frac = num / denom There's this: with np.errstate(divide='ignore'): ...

Re: [Numpy-discussion] Context manager for seterr

2014-12-14 Thread Stefan van der Walt
On 2014-12-15 02:23:18, Julian Taylor jtaylor.deb...@googlemail.com wrote: with np.errstate(divide='ignore'): Perfect, thanks! Stéfan ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Context manager for seterr

2014-12-14 Thread Julian Taylor
On 15.12.2014 01:40, Stefan van der Walt wrote: On 2014-12-15 02:23:18, Julian Taylor jtaylor.deb...@googlemail.com wrote: already exists as np.errstate: with np.errstate(divide='ignore'): With 'ignore' a warning is still raised--is this by choice? import numpy as np x = np.array([0, 1,