Lines Matching +full:import +full:- +full: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:
37 >>> import threading
50 Of course, values you get from a local object, including a __dict__
56 You can create custom local objects by subclassing the local class:
58 >>> class MyLocal(local):
67 called each time the local object is used in a separate thread. This
70 Now if we create a local object:
109 local. They are shared across threads:
111 >>> class MyLocal(local):
132 __all__ = ["local"]
135 # module may also want to use our `local` class, if support for locals
137 # with circular imports. For that reason, we don't import `threading`
140 # locals in the `thread` module, and there is no circular import problem
149 key = '_local__key', 'thread.local.' + str(id(self))
182 class local(_localbase): class
196 "%r object attribute '__dict__' is read-only"
209 "%r object attribute '__dict__' is read-only"
220 import threading
225 # We use the non-locking API since we might already hold the lock
247 from threading import current_thread, RLock