threading.Barrier.wait()

wait(timeout=None) Pass the barrier. When all the threads party to the barrier have called this function, they are all released simultaneously. If a timeout is provided, it is used in preference to any that was supplied to the class constructor. The return value is an integer in the range 0 to parties – 1, different for each thread. This can be used to select a thread to do some special housekeeping, e.g.: i = barrier.wait() if i == 0: # Only one thread needs to print this print("pas

threading.Barrier.abort()

abort() Put the barrier into a broken state. This causes any active or future calls to wait() to fail with the BrokenBarrierError. Use this for example if one of the needs to abort, to avoid deadlocking the application. It may be preferable to simply create the barrier with a sensible timeout value to automatically guard against one of the threads going awry.

threading.Barrier.n_waiting

n_waiting The number of threads currently waiting in the barrier.

threading.Barrier.parties

parties The number of threads required to pass the barrier.

threading.Barrier.broken

broken A boolean that is True if the barrier is in the broken state.

threading.active_count()

threading.active_count() Return the number of Thread objects currently alive. The returned count is equal to the length of the list returned by enumerate().

threading.Barrier

class threading.Barrier(parties, action=None, timeout=None) Create a barrier object for parties number of threads. An action, when provided, is a callable to be called by one of the threads when they are released. timeout is the default timeout value if none is specified for the wait() method. wait(timeout=None) Pass the barrier. When all the threads party to the barrier have called this function, they are all released simultaneously. If a timeout is provided, it is used in preference to

textwrap.TextWrapper.width

width (default: 70) The maximum length of wrapped lines. As long as there are no individual words in the input text longer than width, TextWrapper guarantees that no output line will be longer than width characters.

textwrap.TextWrapper.tabsize

tabsize (default: 8) If expand_tabs is true, then all tab characters in text will be expanded to zero or more spaces, depending on the current column and the given tab size. New in version 3.3.

textwrap.wrap()

textwrap.wrap(text, width=70, **kwargs) Wraps the single paragraph in text (a string) so every line is at most width characters long. Returns a list of output lines, without final newlines. Optional keyword arguments correspond to the instance attributes of TextWrapper, documented below. width defaults to 70. See the TextWrapper.wrap() method for additional details on how wrap() behaves.