deepcopy of class inherited from Thread

Mick Krippendorf mad.mick at gmx.de
Mon Oct 12 20:07:49 CEST 2009


VYAS ASHISH M-NTB837 schrieb:
>  
> The function that I want to run is part of a class, not a standalone
> function. There are several class member variables also.

Then try:

class MyClass(object):
    ...
    def run(self):
	""" do threaded stuff here """
    ...

Thread(target=MyClass().run).start()
Thread(target=MyClass().run).start()
Thread(target=MyClass().run).start()
Thread(target=MyClass().run).start()
Thread(target=MyClass().run).start()


And *please* don't always quote the whole article in your answer.

Mick.



More information about the Python-list mailing list