__import__()

__import__(name, globals=None, locals=None, fromlist=(), level=0) Note This is an advanced function that is not needed in everyday Python programming, unlike importlib.import_module(). This function is invoked by the import statement. It can be replaced (by importing the builtins module and assigning to builtins.__import__) in order to change semantics of the import statement, but doing so is strongly discouraged as it is usually simpler to use import hooks (see PEP 302) to attain the same

__main__

'__main__' is the name of the scope in which top-level code executes. A module’s __name__ is set equal to '__main__' when read from standard input, a script, or from an interactive prompt. A module can discover whether or not it is running in the main scope by checking its own __name__, which allows a common idiom for conditionally executing code in a module when it is run as a script or with python -m but not when it is imported: if __name__ == "__main__": # execute only if run as a script

__future__

Source code: Lib/__future__.py __future__ is a real module, and serves three purposes: To avoid confusing existing tools that analyze import statements and expect to find the modules they’re importing. To ensure that future statements run under releases prior to 2.1 at least yield runtime exceptions (the import of __future__ will fail, because there was no module of that name prior to 2.1). To document when incompatible changes were introduced, and when they will be — or were — made mandatory.

__debug__

__debug__ This constant is true if Python was not started with an -O option. See also the assert statement.

_thread.interrupt_main()

_thread.interrupt_main() Raise a KeyboardInterrupt exception in the main thread. A subthread can use this function to interrupt the main thread.

_thread.stack_size()

_thread.stack_size([size]) Return the thread stack size used when creating new threads. The optional size argument specifies the stack size to be used for subsequently created threads, and must be 0 (use platform or configured default) or a positive integer value of at least 32,768 (32 KiB). If size is not specified, 0 is used. If changing the thread stack size is unsupported, a RuntimeError is raised. If the specified stack size is invalid, a ValueError is raised and the stack size is unmod

_thread.lock.acquire()

lock.acquire(waitflag=1, timeout=-1) Without any optional argument, this method acquires the lock unconditionally, if necessary waiting until it is released by another thread (only one thread at a time can acquire a lock — that’s their reason for existence). If the integer waitflag argument is present, the action depends on its value: if it is zero, the lock is only acquired if it can be acquired immediately without waiting, while if it is nonzero, the lock is acquired unconditionally as abo

_thread.LockType

_thread.LockType This is the type of lock objects.

_thread.lock.release()

lock.release() Releases the lock. The lock must have been acquired earlier, but not necessarily by the same thread.

_thread.lock.locked()

lock.locked() Return the status of the lock: True if it has been acquired by some thread, False if not.