[Numpy-discussion] Release blockers for 1.4.0 ?

Robert Kern robert.kern at gmail.com
Wed Dec 9 11:29:45 EST 2009


On Wed, Dec 9, 2009 at 01:41, Anne Archibald <peridot.faceted at gmail.com> wrote:
> 2009/12/8 Robert Kern <robert.kern at 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