On Fri, Sep 14, 2018 at 7:18 PM, Antoon Pardon wrote:
> On 14-09-18 10:29, Chris Angelico wrote:
>> On Fri, Sep 14, 2018 at 5:25 PM, Antoon Pardon wrote:
>>>
>>> ... Suppose I have two threads, one in which I need
>>> a precision of 3 and the other in which I need a precision of 7. In what
>>> ci
On 14-09-18 10:29, Chris Angelico wrote:
> On Fri, Sep 14, 2018 at 5:25 PM, Antoon Pardon wrote:
>>
>> ... Suppose I have two threads, one in which I need
>> a precision of 3 and the other in which I need a precision of 7. In what
>> circumstances is it needed to use threads-locals to accomplish t
On Fri, Sep 14, 2018 at 6:34 PM, Thomas Jollans wrote:
> On 14/09/18 10:29, Chris Angelico wrote:
>>
>> On Fri, Sep 14, 2018 at 5:25 PM, Antoon Pardon
>> wrote:
>>>
>>> On 13-09-18 14:29, Chris Angelico wrote:
"Preferred" doesn't exclude the possibility that alternatives are
needed
On 14/09/18 10:29, Chris Angelico wrote:
On Fri, Sep 14, 2018 at 5:25 PM, Antoon Pardon wrote:
On 13-09-18 14:29, Chris Angelico wrote:
"Preferred" doesn't exclude the possibility that alternatives are
needed, though. For example, good luck making decimal.Decimal contexts
work correctly withou
On Fri, Sep 14, 2018 at 5:25 PM, Antoon Pardon wrote:
> On 13-09-18 14:29, Chris Angelico wrote:
>> "Preferred" doesn't exclude the possibility that alternatives are
>> needed, though. For example, good luck making decimal.Decimal contexts
>> work correctly without the help of thread-locals - ther
On 13-09-18 14:29, Chris Angelico wrote:
> "Preferred" doesn't exclude the possibility that alternatives are
> needed, though. For example, good luck making decimal.Decimal contexts
> work correctly without the help of thread-locals - there MIGHT be a
> way to do it, but even if there is, it sure w
On Fri, Sep 14, 2018 at 1:07 AM, Peter Otten <__pete...@web.de> wrote:
> However, the trouble begins with
>
> a/b # magically determine context
>
> which has no way to smuggle in a third argument. The workaround while not
> pretty is at least straightforward:
>
> context.divide(a, b)
Exactly. You
Chris Angelico wrote:
> On Thu, Sep 13, 2018 at 10:22 PM, Peter Otten <__pete...@web.de> wrote:
>> Antoon Pardon wrote:
>>
>>> On 12-09-18 22:14, Peter Otten wrote:
As I understand it you need one local() instance that is shared by all
workers. Every thead will then see thread-specific v
On Thu, Sep 13, 2018 at 10:22 PM, Peter Otten <__pete...@web.de> wrote:
> Antoon Pardon wrote:
>
>> On 12-09-18 22:14, Peter Otten wrote:
>>> As I understand it you need one local() instance that is shared by all
>>> workers. Every thead will then see thread-specific values.
>>
>> It has always puz
Antoon Pardon wrote:
> On 12-09-18 22:14, Peter Otten wrote:
>> As I understand it you need one local() instance that is shared by all
>> workers. Every thead will then see thread-specific values.
>
> It has always puzzled me how this is useful. The times I work with
> threads, I just put thread
On 13Sep2018 12:21, Antoon Pardon wrote:
On 12-09-18 22:14, Peter Otten wrote:
As I understand it you need one local() instance that is shared by all
workers. Every thead will then see thread-specific values.
It has always puzzled me how this is useful. The times I work with threads,
I just p
On 12-09-18 22:14, Peter Otten wrote:
> As I understand it you need one local() instance that is shared by all
> workers. Every thead will then see thread-specific values.
It has always puzzled me how this is useful. The times I work with threads,
I just put thread specific values in the local va
Steven D'Aprano wrote:
> I'm originally posted this on the Python-Ideas list, but this is probably
> more appropriate.
>
>
> import time
> from threading import Thread, local
>
> def func():
> pass
>
> def attach(value):
# no new local() here
> func.__params__.value = value
>
>
On 2018-09-12 17:16, Steven D'Aprano wrote:
I'm originally posted this on the Python-Ideas list, but this is probably
more appropriate.
import time
from threading import Thread, local
def func():
pass
def attach(value):
func.__params__ = local()
func.__params__.value = value
I'm originally posted this on the Python-Ideas list, but this is probably
more appropriate.
import time
from threading import Thread, local
def func():
pass
def attach(value):
func.__params__ = local()
func.__params__.value = value
def worker(i):
print("called from thread %s"
15 matches
Mail list logo