[Numpy-discussion] Warnings in numpy.ma.test()

Darren Dale dsdale24 at gmail.com
Wed Mar 17 10:20:11 EDT 2010


On Wed, Mar 17, 2010 at 10:11 AM, Ryan May <rmay31 at gmail.com> wrote:
> On Wed, Mar 17, 2010 at 7:19 AM, Darren Dale <dsdale24 at gmail.com> wrote:
>> Is this general enough for your use case? I haven't tried to think
>> about how to change some global state at one point and change it back
>> at another, that seems like a bad idea and difficult to support.
>
> Sounds like the textbook use case for the python 2.5/2.6 context
> manager.   Pity we can't use it yet... (and I'm not sure it'd be easy
> to wrap around the calls here.)

I don't think context managers would work. They would be implemented
in one of the subclasses special methods and would thus go out of
scope before the ufunc got around to performing the calculation that
required the change in state.

Darren



More information about the NumPy-Discussion mailing list