On Wed, Mar 17, 2010 at 10:11 AM, Ryan May <rma...@gmail.com> wrote: > On Wed, Mar 17, 2010 at 7:19 AM, Darren Dale <dsdal...@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 _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion