Get stream variable arguments
3 answers
Following the pilots answer - I am using this working solution:
from threading import Thread
class myThread(Thread):
args = None
def __init__(self, group=None, target=None, args=(), name=None, kwargs = None, daemon = None):
self.args = args
super(RaThread, self).__init__(group=group, target=target, args=args, name=name, kwargs=kwargs, daemon=daemon)
Thanks everyone for the help!
0
source to share
_Thread__args
and _Thread__kwargs
store the constructor arguments.
However, as you might guess from the underscores, they are not part of the public API. Indeed, "malformed, renamed attributes" are intended to prevent direct access.
Also, these attributes are specific to the CPython implementation. For example, Jython does not expose these attributes by these names (disclaimer: I haven't tested, but just looked at the source).
In your case, it would be better to store the arguments in some application-meaningful way in a Thread subclass and access them.
+3
source to share