started other ways to code threads with _thread although the preceding script runs simple functionany callable object may be run in the threadbecause all threads live in the same process for instancea thread can also run lambda function or bound method of an object (the following code is part of file thread-alts py in the book examples package)import _thread all print def action( )print( * function run in threads class powerdef __init__(selfi)self def action(self)print(self * bound method run in threads _thread start_new_thread(action( ,)simple function _thread start_new_thread((lambdaaction( ))()lambda function to defer obj power( _thread start_new_thread(obj action()bound method object as we'll see in larger examples later in this bookbound methods are especially useful in this role--because they remember both the method function and instance objectthey also give access to state information and class methods for use within and during the thread more fundamentallybecause threads all run in the same processbound methods run by threads reference the original in-process instance objectnot copy of it henceany changes to its state made in thread will be visible to all threads automatically moreoversince bound methods of class instance pass for callables interchangeably with simple functionsusing them in threads this way just works and as we'll see laterthe fact that they are normal objects also allows them to be stored freely on shared queues running multiple threads to really understand the power of threads running in parallelthoughwe have to do something more long-lived in our threadsjust as we did earlier for processes let' mutate the fork-count program of the prior section to use threads the script in example - starts copies of its counter function running in parallel threads example - pp \system\threads\thread-count py ""thread basicsstart copies of function running in parallelthreads