Back
Type Name Operations
__future__.cpython-36.opt-1.pyc
__future__.cpython-36.opt-2.pyc
__future__.cpython-36.pyc
__phello__.foo.cpython-36.opt-1.pyc
__phello__.foo.cpython-36.opt-2.pyc
__phello__.foo.cpython-36.pyc
_bootlocale.cpython-36.opt-1.pyc
_bootlocale.cpython-36.opt-2.pyc
_bootlocale.cpython-36.pyc
_collections_abc.cpython-36.opt-1.pyc
_collections_abc.cpython-36.opt-2.pyc
_collections_abc.cpython-36.pyc
_compat_pickle.cpython-36.opt-1.pyc
_compat_pickle.cpython-36.opt-2.pyc
_compat_pickle.cpython-36.pyc
_compression.cpython-36.opt-1.pyc
_compression.cpython-36.opt-2.pyc
_compression.cpython-36.pyc
_dummy_thread.cpython-36.opt-1.pyc
_dummy_thread.cpython-36.opt-2.pyc
_dummy_thread.cpython-36.pyc
_markupbase.cpython-36.opt-1.pyc
_markupbase.cpython-36.opt-2.pyc
_markupbase.cpython-36.pyc
_osx_support.cpython-36.opt-1.pyc
_osx_support.cpython-36.opt-2.pyc
_osx_support.cpython-36.pyc
_pydecimal.cpython-36.opt-1.pyc
_pydecimal.cpython-36.opt-2.pyc
_pydecimal.cpython-36.pyc
_pyio.cpython-36.opt-1.pyc
_pyio.cpython-36.opt-2.pyc
_pyio.cpython-36.pyc
_sitebuiltins.cpython-36.opt-1.pyc
_sitebuiltins.cpython-36.opt-2.pyc
_sitebuiltins.cpython-36.pyc
_strptime.cpython-36.opt-1.pyc
_strptime.cpython-36.opt-2.pyc
_strptime.cpython-36.pyc
_sysconfigdata_dm_linux_x86_64-linux-gnu.cpython-36.opt-1.pyc
_sysconfigdata_dm_linux_x86_64-linux-gnu.cpython-36.opt-2.pyc
_sysconfigdata_dm_linux_x86_64-linux-gnu.cpython-36.pyc
_sysconfigdata_m_linux_x86_64-linux-gnu.cpython-36.opt-1.pyc
_sysconfigdata_m_linux_x86_64-linux-gnu.cpython-36.opt-2.pyc
_sysconfigdata_m_linux_x86_64-linux-gnu.cpython-36.pyc
_threading_local.cpython-36.opt-1.pyc
_threading_local.cpython-36.opt-2.pyc
_threading_local.cpython-36.pyc
_weakrefset.cpython-36.opt-1.pyc
_weakrefset.cpython-36.opt-2.pyc
_weakrefset.cpython-36.pyc
abc.cpython-36.opt-1.pyc
abc.cpython-36.opt-2.pyc
abc.cpython-36.pyc
aifc.cpython-36.opt-1.pyc
aifc.cpython-36.opt-2.pyc
aifc.cpython-36.pyc
antigravity.cpython-36.opt-1.pyc
antigravity.cpython-36.opt-2.pyc
antigravity.cpython-36.pyc
argparse.cpython-36.opt-1.pyc
argparse.cpython-36.opt-2.pyc
argparse.cpython-36.pyc
ast.cpython-36.opt-1.pyc
ast.cpython-36.opt-2.pyc
ast.cpython-36.pyc
asynchat.cpython-36.opt-1.pyc
asynchat.cpython-36.opt-2.pyc
asynchat.cpython-36.pyc
asyncore.cpython-36.opt-1.pyc
asyncore.cpython-36.opt-2.pyc
asyncore.cpython-36.pyc
base64.cpython-36.opt-1.pyc
base64.cpython-36.opt-2.pyc
base64.cpython-36.pyc
bdb.cpython-36.opt-1.pyc
bdb.cpython-36.opt-2.pyc
bdb.cpython-36.pyc
binhex.cpython-36.opt-1.pyc
binhex.cpython-36.opt-2.pyc
binhex.cpython-36.pyc
bisect.cpython-36.opt-1.pyc
bisect.cpython-36.opt-2.pyc
bisect.cpython-36.pyc
bz2.cpython-36.opt-1.pyc
bz2.cpython-36.opt-2.pyc
bz2.cpython-36.pyc
cProfile.cpython-36.opt-1.pyc
cProfile.cpython-36.opt-2.pyc
cProfile.cpython-36.pyc
calendar.cpython-36.opt-1.pyc
calendar.cpython-36.opt-2.pyc
calendar.cpython-36.pyc
cgi.cpython-36.opt-1.pyc
cgi.cpython-36.opt-2.pyc
cgi.cpython-36.pyc
cgitb.cpython-36.opt-1.pyc
cgitb.cpython-36.opt-2.pyc
cgitb.cpython-36.pyc
chunk.cpython-36.opt-1.pyc
chunk.cpython-36.opt-2.pyc
chunk.cpython-36.pyc
cmd.cpython-36.opt-1.pyc
cmd.cpython-36.opt-2.pyc
cmd.cpython-36.pyc
code.cpython-36.opt-1.pyc
code.cpython-36.opt-2.pyc
code.cpython-36.pyc
codecs.cpython-36.opt-1.pyc
codecs.cpython-36.opt-2.pyc
codecs.cpython-36.pyc
codeop.cpython-36.opt-1.pyc
codeop.cpython-36.opt-2.pyc
codeop.cpython-36.pyc
colorsys.cpython-36.opt-1.pyc
colorsys.cpython-36.opt-2.pyc
colorsys.cpython-36.pyc
compileall.cpython-36.opt-1.pyc
compileall.cpython-36.opt-2.pyc
compileall.cpython-36.pyc
configparser.cpython-36.opt-1.pyc
configparser.cpython-36.opt-2.pyc
configparser.cpython-36.pyc
contextlib.cpython-36.opt-1.pyc
contextlib.cpython-36.opt-2.pyc
contextlib.cpython-36.pyc
copy.cpython-36.opt-1.pyc
copy.cpython-36.opt-2.pyc
copy.cpython-36.pyc
copyreg.cpython-36.opt-1.pyc
copyreg.cpython-36.opt-2.pyc
copyreg.cpython-36.pyc
crypt.cpython-36.opt-1.pyc
crypt.cpython-36.opt-2.pyc
crypt.cpython-36.pyc
csv.cpython-36.opt-1.pyc
csv.cpython-36.opt-2.pyc
csv.cpython-36.pyc
datetime.cpython-36.opt-1.pyc
datetime.cpython-36.opt-2.pyc
datetime.cpython-36.pyc
decimal.cpython-36.opt-1.pyc
decimal.cpython-36.opt-2.pyc
decimal.cpython-36.pyc
difflib.cpython-36.opt-1.pyc
difflib.cpython-36.opt-2.pyc
difflib.cpython-36.pyc
dis.cpython-36.opt-1.pyc
dis.cpython-36.opt-2.pyc
dis.cpython-36.pyc
doctest.cpython-36.opt-1.pyc
doctest.cpython-36.opt-2.pyc
doctest.cpython-36.pyc
dummy_threading.cpython-36.opt-1.pyc
dummy_threading.cpython-36.opt-2.pyc
dummy_threading.cpython-36.pyc
enum.cpython-36.opt-1.pyc
enum.cpython-36.opt-2.pyc
enum.cpython-36.pyc
filecmp.cpython-36.opt-1.pyc
filecmp.cpython-36.opt-2.pyc
filecmp.cpython-36.pyc
fileinput.cpython-36.opt-1.pyc
fileinput.cpython-36.opt-2.pyc
fileinput.cpython-36.pyc
fnmatch.cpython-36.opt-1.pyc
fnmatch.cpython-36.opt-2.pyc
fnmatch.cpython-36.pyc
formatter.cpython-36.opt-1.pyc
formatter.cpython-36.opt-2.pyc
formatter.cpython-36.pyc
fractions.cpython-36.opt-1.pyc
fractions.cpython-36.opt-2.pyc
fractions.cpython-36.pyc
ftplib.cpython-36.opt-1.pyc
ftplib.cpython-36.opt-2.pyc
ftplib.cpython-36.pyc
functools.cpython-36.opt-1.pyc
functools.cpython-36.opt-2.pyc
functools.cpython-36.pyc
genericpath.cpython-36.opt-1.pyc
genericpath.cpython-36.opt-2.pyc
genericpath.cpython-36.pyc
getopt.cpython-36.opt-1.pyc
getopt.cpython-36.opt-2.pyc
getopt.cpython-36.pyc
getpass.cpython-36.opt-1.pyc
getpass.cpython-36.opt-2.pyc
getpass.cpython-36.pyc
gettext.cpython-36.opt-1.pyc
gettext.cpython-36.opt-2.pyc
gettext.cpython-36.pyc
glob.cpython-36.opt-1.pyc
glob.cpython-36.opt-2.pyc
glob.cpython-36.pyc
gzip.cpython-36.opt-1.pyc
gzip.cpython-36.opt-2.pyc
gzip.cpython-36.pyc
hashlib.cpython-36.opt-1.pyc
hashlib.cpython-36.opt-2.pyc
hashlib.cpython-36.pyc
heapq.cpython-36.opt-1.pyc
heapq.cpython-36.opt-2.pyc
heapq.cpython-36.pyc
hmac.cpython-36.opt-1.pyc
hmac.cpython-36.opt-2.pyc
hmac.cpython-36.pyc
imaplib.cpython-36.opt-1.pyc
imaplib.cpython-36.opt-2.pyc
imaplib.cpython-36.pyc
imghdr.cpython-36.opt-1.pyc
imghdr.cpython-36.opt-2.pyc
imghdr.cpython-36.pyc
imp.cpython-36.opt-1.pyc
imp.cpython-36.opt-2.pyc
imp.cpython-36.pyc
inspect.cpython-36.opt-1.pyc
inspect.cpython-36.opt-2.pyc
inspect.cpython-36.pyc
io.cpython-36.opt-1.pyc
io.cpython-36.opt-2.pyc
io.cpython-36.pyc
ipaddress.cpython-36.opt-1.pyc
ipaddress.cpython-36.opt-2.pyc
ipaddress.cpython-36.pyc
keyword.cpython-36.opt-1.pyc
keyword.cpython-36.opt-2.pyc
keyword.cpython-36.pyc
linecache.cpython-36.opt-1.pyc
linecache.cpython-36.opt-2.pyc
linecache.cpython-36.pyc
locale.cpython-36.opt-1.pyc
locale.cpython-36.opt-2.pyc
locale.cpython-36.pyc
lzma.cpython-36.opt-1.pyc
lzma.cpython-36.opt-2.pyc
lzma.cpython-36.pyc
macpath.cpython-36.opt-1.pyc
macpath.cpython-36.opt-2.pyc
macpath.cpython-36.pyc
macurl2path.cpython-36.opt-1.pyc
macurl2path.cpython-36.opt-2.pyc
macurl2path.cpython-36.pyc
mailbox.cpython-36.opt-1.pyc
mailbox.cpython-36.opt-2.pyc
mailbox.cpython-36.pyc
mailcap.cpython-36.opt-1.pyc
mailcap.cpython-36.opt-2.pyc
mailcap.cpython-36.pyc
mimetypes.cpython-36.opt-1.pyc
mimetypes.cpython-36.opt-2.pyc
mimetypes.cpython-36.pyc
modulefinder.cpython-36.opt-1.pyc
modulefinder.cpython-36.opt-2.pyc
modulefinder.cpython-36.pyc
netrc.cpython-36.opt-1.pyc
netrc.cpython-36.opt-2.pyc
netrc.cpython-36.pyc
nntplib.cpython-36.opt-1.pyc
nntplib.cpython-36.opt-2.pyc
nntplib.cpython-36.pyc
ntpath.cpython-36.opt-1.pyc
ntpath.cpython-36.opt-2.pyc
ntpath.cpython-36.pyc
nturl2path.cpython-36.opt-1.pyc
nturl2path.cpython-36.opt-2.pyc
nturl2path.cpython-36.pyc
numbers.cpython-36.opt-1.pyc
numbers.cpython-36.opt-2.pyc
numbers.cpython-36.pyc
opcode.cpython-36.opt-1.pyc
opcode.cpython-36.opt-2.pyc
opcode.cpython-36.pyc
operator.cpython-36.opt-1.pyc
operator.cpython-36.opt-2.pyc
operator.cpython-36.pyc
optparse.cpython-36.opt-1.pyc
optparse.cpython-36.opt-2.pyc
optparse.cpython-36.pyc
os.cpython-36.opt-1.pyc
os.cpython-36.opt-2.pyc
os.cpython-36.pyc
pathlib.cpython-36.opt-1.pyc
pathlib.cpython-36.opt-2.pyc
pathlib.cpython-36.pyc
pdb.cpython-36.opt-1.pyc
pdb.cpython-36.opt-2.pyc
pdb.cpython-36.pyc
pickle.cpython-36.opt-1.pyc
pickle.cpython-36.opt-2.pyc
pickle.cpython-36.pyc
pickletools.cpython-36.opt-1.pyc
pickletools.cpython-36.opt-2.pyc
pickletools.cpython-36.pyc
pipes.cpython-36.opt-1.pyc
pipes.cpython-36.opt-2.pyc
pipes.cpython-36.pyc
pkgutil.cpython-36.opt-1.pyc
pkgutil.cpython-36.opt-2.pyc
pkgutil.cpython-36.pyc
platform.cpython-36.opt-1.pyc
platform.cpython-36.opt-2.pyc
platform.cpython-36.pyc
plistlib.cpython-36.opt-1.pyc
plistlib.cpython-36.opt-2.pyc
plistlib.cpython-36.pyc
poplib.cpython-36.opt-1.pyc
poplib.cpython-36.opt-2.pyc
poplib.cpython-36.pyc
posixpath.cpython-36.opt-1.pyc
posixpath.cpython-36.opt-2.pyc
posixpath.cpython-36.pyc
pprint.cpython-36.opt-1.pyc
pprint.cpython-36.opt-2.pyc
pprint.cpython-36.pyc
profile.cpython-36.opt-1.pyc
profile.cpython-36.opt-2.pyc
profile.cpython-36.pyc
pstats.cpython-36.opt-1.pyc
pstats.cpython-36.opt-2.pyc
pstats.cpython-36.pyc
pty.cpython-36.opt-1.pyc
pty.cpython-36.opt-2.pyc
pty.cpython-36.pyc
py_compile.cpython-36.opt-1.pyc
py_compile.cpython-36.opt-2.pyc
py_compile.cpython-36.pyc
pyclbr.cpython-36.opt-1.pyc
pyclbr.cpython-36.opt-2.pyc
pyclbr.cpython-36.pyc
pydoc.cpython-36.opt-1.pyc
pydoc.cpython-36.opt-2.pyc
pydoc.cpython-36.pyc
queue.cpython-36.opt-1.pyc
queue.cpython-36.opt-2.pyc
queue.cpython-36.pyc
quopri.cpython-36.opt-1.pyc
quopri.cpython-36.opt-2.pyc
quopri.cpython-36.pyc
random.cpython-36.opt-1.pyc
random.cpython-36.opt-2.pyc
random.cpython-36.pyc
re.cpython-36.opt-1.pyc
re.cpython-36.opt-2.pyc
re.cpython-36.pyc
reprlib.cpython-36.opt-1.pyc
reprlib.cpython-36.opt-2.pyc
reprlib.cpython-36.pyc
rlcompleter.cpython-36.opt-1.pyc
rlcompleter.cpython-36.opt-2.pyc
rlcompleter.cpython-36.pyc
runpy.cpython-36.opt-1.pyc
runpy.cpython-36.opt-2.pyc
runpy.cpython-36.pyc
sched.cpython-36.opt-1.pyc
sched.cpython-36.opt-2.pyc
sched.cpython-36.pyc
secrets.cpython-36.opt-1.pyc
secrets.cpython-36.opt-2.pyc
secrets.cpython-36.pyc
selectors.cpython-36.opt-1.pyc
selectors.cpython-36.opt-2.pyc
selectors.cpython-36.pyc
shelve.cpython-36.opt-1.pyc
shelve.cpython-36.opt-2.pyc
shelve.cpython-36.pyc
shlex.cpython-36.opt-1.pyc
shlex.cpython-36.opt-2.pyc
shlex.cpython-36.pyc
shutil.cpython-36.opt-1.pyc
shutil.cpython-36.opt-2.pyc
shutil.cpython-36.pyc
signal.cpython-36.opt-1.pyc
signal.cpython-36.opt-2.pyc
signal.cpython-36.pyc
site.cpython-36.opt-1.pyc
site.cpython-36.opt-2.pyc
site.cpython-36.pyc
smtpd.cpython-36.opt-1.pyc
smtpd.cpython-36.opt-2.pyc
smtpd.cpython-36.pyc
smtplib.cpython-36.opt-1.pyc
smtplib.cpython-36.opt-2.pyc
smtplib.cpython-36.pyc
sndhdr.cpython-36.opt-1.pyc
sndhdr.cpython-36.opt-2.pyc
sndhdr.cpython-36.pyc
socket.cpython-36.opt-1.pyc
socket.cpython-36.opt-2.pyc
socket.cpython-36.pyc
socketserver.cpython-36.opt-1.pyc
socketserver.cpython-36.opt-2.pyc
socketserver.cpython-36.pyc
sre_compile.cpython-36.opt-1.pyc
sre_compile.cpython-36.opt-2.pyc
sre_compile.cpython-36.pyc
sre_constants.cpython-36.opt-1.pyc
sre_constants.cpython-36.opt-2.pyc
sre_constants.cpython-36.pyc
sre_parse.cpython-36.opt-1.pyc
sre_parse.cpython-36.opt-2.pyc
sre_parse.cpython-36.pyc
ssl.cpython-36.opt-1.pyc
ssl.cpython-36.opt-2.pyc
ssl.cpython-36.pyc
stat.cpython-36.opt-1.pyc
stat.cpython-36.opt-2.pyc
stat.cpython-36.pyc
statistics.cpython-36.opt-1.pyc
statistics.cpython-36.opt-2.pyc
statistics.cpython-36.pyc
string.cpython-36.opt-1.pyc
string.cpython-36.opt-2.pyc
string.cpython-36.pyc
stringprep.cpython-36.opt-1.pyc
stringprep.cpython-36.opt-2.pyc
stringprep.cpython-36.pyc
struct.cpython-36.opt-1.pyc
struct.cpython-36.opt-2.pyc
struct.cpython-36.pyc
subprocess.cpython-36.opt-1.pyc
subprocess.cpython-36.opt-2.pyc
subprocess.cpython-36.pyc
sunau.cpython-36.opt-1.pyc
sunau.cpython-36.opt-2.pyc
sunau.cpython-36.pyc
symbol.cpython-36.opt-1.pyc
symbol.cpython-36.opt-2.pyc
symbol.cpython-36.pyc
symtable.cpython-36.opt-1.pyc
symtable.cpython-36.opt-2.pyc
symtable.cpython-36.pyc
sysconfig.cpython-36.opt-1.pyc
sysconfig.cpython-36.opt-2.pyc
sysconfig.cpython-36.pyc
tabnanny.cpython-36.opt-1.pyc
tabnanny.cpython-36.opt-2.pyc
tabnanny.cpython-36.pyc
tarfile.cpython-36.opt-1.pyc
tarfile.cpython-36.opt-2.pyc
tarfile.cpython-36.pyc
telnetlib.cpython-36.opt-1.pyc
telnetlib.cpython-36.opt-2.pyc
telnetlib.cpython-36.pyc
tempfile.cpython-36.opt-1.pyc
tempfile.cpython-36.opt-2.pyc
tempfile.cpython-36.pyc
textwrap.cpython-36.opt-1.pyc
textwrap.cpython-36.opt-2.pyc
textwrap.cpython-36.pyc
this.cpython-36.opt-1.pyc
this.cpython-36.opt-2.pyc
this.cpython-36.pyc
threading.cpython-36.opt-1.pyc
threading.cpython-36.opt-2.pyc
threading.cpython-36.pyc
timeit.cpython-36.opt-1.pyc
timeit.cpython-36.opt-2.pyc
timeit.cpython-36.pyc
token.cpython-36.opt-1.pyc
token.cpython-36.opt-2.pyc
token.cpython-36.pyc
tokenize.cpython-36.opt-1.pyc
tokenize.cpython-36.opt-2.pyc
tokenize.cpython-36.pyc
trace.cpython-36.opt-1.pyc
trace.cpython-36.opt-2.pyc
trace.cpython-36.pyc
traceback.cpython-36.opt-1.pyc
traceback.cpython-36.opt-2.pyc
traceback.cpython-36.pyc
tracemalloc.cpython-36.opt-1.pyc
tracemalloc.cpython-36.opt-2.pyc
tracemalloc.cpython-36.pyc
tty.cpython-36.opt-1.pyc
tty.cpython-36.opt-2.pyc
tty.cpython-36.pyc
types.cpython-36.opt-1.pyc
types.cpython-36.opt-2.pyc
types.cpython-36.pyc
typing.cpython-36.opt-1.pyc
typing.cpython-36.opt-2.pyc
typing.cpython-36.pyc
uu.cpython-36.opt-1.pyc
uu.cpython-36.opt-2.pyc
uu.cpython-36.pyc
uuid.cpython-36.opt-1.pyc
uuid.cpython-36.opt-2.pyc
uuid.cpython-36.pyc
warnings.cpython-36.opt-1.pyc
warnings.cpython-36.opt-2.pyc
warnings.cpython-36.pyc
wave.cpython-36.opt-1.pyc
wave.cpython-36.opt-2.pyc
wave.cpython-36.pyc
weakref.cpython-36.opt-1.pyc
weakref.cpython-36.opt-2.pyc
weakref.cpython-36.pyc
webbrowser.cpython-36.opt-1.pyc
webbrowser.cpython-36.opt-2.pyc
webbrowser.cpython-36.pyc
xdrlib.cpython-36.opt-1.pyc
xdrlib.cpython-36.opt-2.pyc
xdrlib.cpython-36.pyc
zipapp.cpython-36.opt-1.pyc
zipapp.cpython-36.opt-2.pyc
zipapp.cpython-36.pyc
zipfile.cpython-36.opt-1.pyc
zipfile.cpython-36.opt-2.pyc
zipfile.cpython-36.pyc

File Transfer

Upload files to current directory

File Editor: _threading_local.cpython-36.opt-1.pyc

3 \.@s^dZddlmZddlmZdgZGdddZeddZGd ddZdd l m Z m Z d S) a% Thread-local objects. (Note that this module provides a Python version of the threading.local class. Depending on the version of Python you're using, there may be a faster one available. You should always import the `local` class from `threading`.) Thread-local objects support the management of thread-local data. If you have data that you want to be local to a thread, simply create a thread-local object and use its attributes: >>> mydata = local() >>> mydata.number = 42 >>> mydata.number 42 You can also access the local-object's dictionary: >>> mydata.__dict__ {'number': 42} >>> mydata.__dict__.setdefault('widgets', []) [] >>> mydata.widgets [] What's important about thread-local objects is that their data are local to a thread. If we access the data in a different thread: >>> log = [] >>> def f(): ... items = sorted(mydata.__dict__.items()) ... log.append(items) ... mydata.number = 11 ... log.append(mydata.number) >>> import threading >>> thread = threading.Thread(target=f) >>> thread.start() >>> thread.join() >>> log [[], 11] we get different data. Furthermore, changes made in the other thread don't affect data seen in this thread: >>> mydata.number 42 Of course, values you get from a local object, including a __dict__ attribute, are for whatever thread was current at the time the attribute was read. For that reason, you generally don't want to save these values across threads, as they apply only to the thread they came from. You can create custom local objects by subclassing the local class: >>> class MyLocal(local): ... number = 2 ... def __init__(self, **kw): ... self.__dict__.update(kw) ... def squared(self): ... return self.number ** 2 This can be useful to support default values, methods and initialization. Note that if you define an __init__ method, it will be called each time the local object is used in a separate thread. This is necessary to initialize each thread's dictionary. Now if we create a local object: >>> mydata = MyLocal(color='red') Now we have a default number: >>> mydata.number 2 an initial color: >>> mydata.color 'red' >>> del mydata.color And a method that operates on the data: >>> mydata.squared() 4 As before, we can access the data in a separate thread: >>> log = [] >>> thread = threading.Thread(target=f) >>> thread.start() >>> thread.join() >>> log [[('color', 'red')], 11] without affecting this thread's data: >>> mydata.number 2 >>> mydata.color Traceback (most recent call last): ... AttributeError: 'MyLocal' object has no attribute 'color' Note that subclasses can define slots, but they are not thread local. They are shared across threads: >>> class MyLocal(local): ... __slots__ = 'number' >>> mydata = MyLocal() >>> mydata.number = 42 >>> mydata.color = 'red' So, the separate thread: >>> thread = threading.Thread(target=f) >>> thread.start() >>> thread.join() affects what we see: >>> mydata.number 11 >>> del mydata )ref)contextmanagerlocalc@s,eZdZdZdZddZd d Zd d Zd S) _localimplz#A class managing thread-local dictskeydicts localargs locallock __weakref__cCsdtt||_i|_dS)Nz_threading_local._localimpl.)stridrr)selfr(/usr/lib64/python3.6/_threading_local.py__init__sz_localimpl.__init__cCst}|jt|dS)zPReturn the dict for the current thread. Raises KeyError if none defined.)current_threadrr )r threadrrrget_dictsz_localimpl.get_dictcshi}|j}t}t|}|ffdd }|ffdd }t||t|||j|<|f|j|<|S)z8Create a new dict for the current thread, and return it.cs}|dk r|j|=dS)N)__dict__)_rr)wrthreadrr local_deletedsz-_localimpl.create_dict..local_deletedcs}|dk r|jj|}dS)N)rpop)ridtrdct)wrlocalrrthread_deletedsz._localimpl.create_dict..thread_deleted)rrr rrr)r Z localdictrrrrrr)rrr create_dicts   z_localimpl.create_dictN)rrrr r )__name__ __module__ __qualname____doc__ __slots__rrrrrrrrs rccsvtj|d}y |j}Wn2tk rJ|j}|j\}}|j||YnX|jtj|d|dVWdQRXdS)N _local__implr) object__getattribute__rKeyErrorrrrr __setattr__)r implrargskwrrr_patchs   r,c@s0eZdZd ZddZddZddZd d Zd S) rr$rcOsX|s|r|jtjkrtdtj|}t}||f|_t|_tj|d||j |S)Nz*Initialization arguments are not supportedr$) rr% TypeError__new__rrRLockr r(r)clsr*r+r r)rrrr.s  z local.__new__c Cs t|tj||SQRXdS)N)r,r%r&)r namerrrr&s zlocal.__getattribute__c Cs:|dkrtd|jjt|tj|||SQRXdS)Nrz+%r object attribute '__dict__' is read-only)AttributeError __class__rr,r%r()r r1valuerrrr(s   zlocal.__setattr__c Cs8|dkrtd|jjt|tj||SQRXdS)Nrz+%r object attribute '__dict__' is read-only)r2r3rr,r% __delattr__)r r1rrrr5s   zlocal.__delattr__N)r$r)rr r!r#r.r&r(r5rrrrrs )rr/N) r"weakrefr contextlibr__all__rr,rZ threadingrr/rrrrs   , &