Re: Immutable object thread-safety

2008-10-27 Thread Gabriel Genellina
En Sun, 26 Oct 2008 23:25:09 -0200, Alcari The Mad <[EMAIL PROTECTED]> escribió: I am confused about which data structure to rely on thread-safety, or operator in Python? All of the builtin functions(which are implemented in C, like len()) are atomic(but assigning their output to a value may

Re: Immutable object thread-safety

2008-10-26 Thread Alcari The Mad
Laszlo Nagy wrote: > >> Also, the other question is the operation st = 'ThreadBWasHere' is >> atomic? > I think this is the same question. And I believe it is not atomic, > because it is actually rebinding a name. Consider this: > > a,b = b,a > > This will rebind both a and b. In order to be co

Re: Immutable object thread-safety

2008-10-26 Thread Alcari The Mad
k3xji wrote: > Hi all, > > This will probably be a long question/short answer, sorry, but I have > wandered net about the subject and really feel cannot find just enough > information.I want to ask my question by giving an example to > explicitly express my understanding which may be also wrong: >

Re: Immutable object thread-safety

2008-10-26 Thread Laszlo Nagy
This will rebind both a and b. In order to be correct, it MUST happen in two phases: first calculate the right side, then do the rebind to the names on the left side. "rebind to the names" -> "rebind the names found on the left side, to the objects calculated from the expressions on the righ

Re: Immutable object thread-safety

2008-10-26 Thread Laszlo Nagy
Also, the other question is the operation st = 'ThreadBWasHere' is atomic? I think this is the same question. And I believe it is not atomic, because it is actually rebinding a name. Consider this: a,b = b,a This will rebind both a and b. In order to be correct, it MUST happen in two phase