Got it. Thanks.

On Sunday, August 2, 2020 at 12:00:47 PM UTC+3, Oscar wrote:
>
> On Sun, 2 Aug 2020 at 06:32, Paul Royik <[email protected] <javascript:>> 
> wrote: 
> > 
> > Do you mean that now it is not safe to use evaluate=True in one thread 
> and evaluate=False in another? 
>
> It is always fine to use evaluate=True/False. The problem is with 
> using the global evaluate flag: 
>
> In [7]: with evaluate(False): 
>    ...:     a = x + x 
>    ...: 
>
> In [8]: a 
> Out[8]: x + x 
>
> The global flag implicitly changes the behaviour of low-level routines 
> so if a higher-level result is cached with one setting of the global 
> flag then it might not be valid for another setting of the flag. The 
> cache is cleared when changing the flag but that is not thread-safe if 
> two threads are running at the same time. 
>
> It is fine to use evaluate=True/False. It is fine (as far as I know) 
> to use threads without changing any of the global flags. I think it's 
> also fine to change the global flags once before starting any threads. 
>
> What is not fine is having multiple threads running simultaneously and 
> changing the global flags while those threads are running. 
>
>
> Oscar 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/f2aa5478-68c4-4e5f-a8aa-f24c46317592o%40googlegroups.com.

Reply via email to