これは非常に簡単です:
import threading as t
t.local().x = 1
print t.local().x
実行すると、次のようになります。
Traceback (most recent call last):
File "C:\Documents and Settings\e272nk\Desktop\tst.py", line 3, in <module>
print t.local().x
AttributeError: 'thread._local' object has no attribute 'x'
属性の割り当ては正常に機能しているようですが、値を取得できないのはなぜですか?
これは、Windows XP 上の Python v2.7.5 です。