the advantage of taking this more coding-intensive route is that we get both per-thread state information (the usual instance attribute namespace)and set of additional thread-related tools from the framework "for free the thread join method used near the end of this scriptfor instancewaits until the thread exits (by default)we can use this method to prevent the main thread from exiting before its childrenrather than using the time sleep calls and global locks and variables we relied on in earlier threading examples the example script also uses threading lock to synchronize stream access as before (though this name is really just synonym for _thread allocate_lock in the current implementationthe threading module may provide the extra structure of classesbut it doesn' remove the specter of concurrent updates in the multithreading model in general other ways to code threads with threading the thread class can also be used to start simple functionor any other type of callable objectwithout coding subclasses at all--if not redefinedthe thread class' default run method simply calls whatever you pass to its constructor' target argumentwith any provided arguments passed to args (which defaults to (for nonethis allows us to use thread to run simple functionstoothough this call form is not noticeably simpler than the basic _thread module for instancethe following code snippets sketch four different ways to spawn the same sort of thread (see four-threadspy in the examples treeyou can run all four in the same scriptbut would have to also synchronize prints to avoid overlap)import threading_thread def action( )print( * subclass with state class mythread(threading thread)def __init__(selfi)self threading thread __init__(selfdef run(self)print(self * mythread( start(pass action in thread threading thread(target=(lambdaaction( ))thread start(redefine run for action start invokes run(run invokes target same but no lambda wrapper for state threading thread(target=actionargs=( ,)start(callable plus its args basic thread module _thread start_new_thread(action( ,)all-function interface threads