stateor can leverage any of oop' many benefits in general your thread classes don' necessarily have to subclass threadthough in factjust as in the _thread modulethe thread' target in threading may be any type of callable object when combined with techniques such as bound methods and nested scope referencesthe choice between coding techniques becomes even less clear-cuta non-thread class with stateoop class powerdef __init__(selfi)self def action(self)print(self * obj power( threading thread(target=obj actionstart(thread runs bound method nested scope to retain state def action( )def power()print( * return power threading thread(target=action( )start(thread runs returned function both with basic thread module _thread start_new_thread(obj action()_thread start_new_thread(action( )()thread runs callable object as usualthe threading apis are as flexible as the python language itself synchronizing access to shared objects and names revisited earlierwe saw how print operations in threads need to be synchronized with locks to avoid overlapbecause the output stream is shared by all threads more formallythreads need to synchronize their changes to any item that may be shared across thread in process--both objects and namespaces depending on given program' goalsthis might includemutable object in memory (passed or otherwise referenced objects whose lifetimes span threadsnames in global scopes (changeable variables outside thread functions and classesthe contents of modules (each has just one shared copy in the system' module tablefor instanceeven simple global variables can require coordination if concurrent updates are possibleas in example - parallel system tools