yield, curry, mix-in, new.function, global, closure, .... what will work?

ecir.hana at gmail.com ecir.hana at gmail.com
Tue Apr 17 03:51:26 CEST 2007

I'm reading the docs now and I stumbled upon something:
section "15.3 threading -- Higher-level threading interface" mensions
a class "local", in which "... Thread-local data are data whose values
are thread specific. ..."

Does it mean, I can create global variables whose changing is thread-
More specific:

import threading

def change_i(arg):
    global k
    k.i = arg

def change_j(arg):
    global k
    k.j = arg

def changer():

def run(i='', j=''):
    global k
    k = threading.local()
    k.i = i
    k.j = j
    i = k.i
    j = k.j
    return i, j

print run() == ('changed_i', 'changed_j')

Is this ok?

More information about the Python-list mailing list