On Sun, Jul 27, 2014 at 4:24 AM, Robert Kern <robert.k...@gmail.com> wrote:

> On Sun, Jul 27, 2014 at 7:04 AM,  <josef.p...@gmail.com> wrote:
> >
> > On Sat, Jul 26, 2014 at 5:19 PM, Sturla Molden <sturla.mol...@gmail.com>
> > wrote:
> >>
> >> Robert Kern <robert.k...@gmail.com> wrote:
> >>
> >> >> It would presumably require a global threading.RLock for protecting
> the
> >> >> global state.
> >> >
> >> > We would use thread-local storage like we currently do with the
> >> > np.errstate() context manager. Each thread will have its own "global"
> >> > state.
> >>
> >> That sounds like a better plan, yes :)
> >
> > Any "global" state that changes how things are calculated will have
> > unpredictable results.
> >
> > And I don't trust python users to be disciplined enough.
> >
> > issue: Why do I get different results after `import this_funy_package`?
>
> That's why the suggestion is that it be controlled by a context
> manager. The state change will only be limited to the `with:`
> statement. You would not be able to "fire-and-forget" the state
> change.
>

Can you implement a context manager without introducing a global variable
that everyone could set, and forget?

Josef


>
> --
> Robert Kern
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to