Hrvoje Niksic <[EMAIL PROTECTED]> writes:
> Since the += operator is not compiled into a single bytecode
> instruction, it needs the lock.

Aha, you are right.  What I was remembering is that xrange.next
is atomic in CPython, i.e. you can say something like

    counter = xrange(10000)
    
and then

   a = counter.next()

doesn't need a lock.  I am personally squeamish about relying on things
like this but apparently it is a standard idiom.  I will guess, but 
I haven't checked and I don't remember hearing, that itertools.count()
also works like that.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to