Lines Matching defs:local
1 """Thread-local objects.
3 (Note that this module provides a Python version of the threading.local
5 faster one available. You should always import the `local` class from
8 Thread-local objects support the management of thread-local data.
9 If you have data that you want to be local to a thread, simply create
10 a thread-local object and use its attributes:
12 >>> mydata = local()
17 You can also access the local-object's dictionary:
26 What's important about thread-local objects is that their data are
27 local to a thread. If we access the data in a different thread:
49 Of course, values you get from a local object, including a __dict__
55 You can create custom local objects by subclassing the local class:
57 >>> class MyLocal(local):
66 called each time the local object is used in a separate thread. This
69 Now if we create a local object:
108 local. They are shared across threads:
110 >>> class MyLocal(local):
134 __all__ = ["local"]
137 # module may also want to use our `local` class, if support for locals
147 """A class managing thread-local dicts"""
155 # { id(Thread) -> (ref(Thread), thread-local dict) }
176 # When the thread is deleted, remove the local dict.
180 local = wrlocal()
181 if local is not None:
182 dct = local.dicts.pop(idt)
204 class local: