[Numpy-discussion] Release blockers for 1.4.0 ?

Robert Kern robert.kern@gmail....
Wed Dec 9 10:29:45 CST 2009


On Wed, Dec 9, 2009 at 01:41, Anne Archibald <peridot.faceted@gmail.com> wrote:
> 2009/12/8 Robert Kern <robert.kern@gmail.com>:

>>  olderr = np.seterr(divide='ignore', invalid='ignore')
>>  try:
>>    result = self.f(da, db, *args, **kwargs)
>>  finally:
>>    np.seterr(**olderr)
>
> Doesn't this risk a ctrl-C after the seterr but before the try? How about:
> olderr = np.geterr()
> try:
>    np.seterr(....)
>    do_whatever()
> finally:
>    np.seterr(**olderr)

Fair point.

> (I guess this would be why context managers were invented...)

Oh yes.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco


More information about the NumPy-Discussion mailing list