[Numpy-discussion] numpy.mean still broken for largefloat32arrays

josef.pktd at gmail.com josef.pktd at gmail.com
Sun Jul 27 04:56:32 EDT 2014


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

> On Sun, Jul 27, 2014 at 7:04 AM,  <josef.pktd at gmail.com> wrote:
> >
> > On Sat, Jul 26, 2014 at 5:19 PM, Sturla Molden <sturla.molden at gmail.com>
> > wrote:
> >>
> >> Robert Kern <robert.kern at 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 at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140727/93b9a240/attachment.html>


More information about the NumPy-Discussion mailing list