I have a very simple question:
myThread = Thread(target=TestTarget, args=(1, Event(),))
Is it possible to get the arguments just using the Variable myThread?
Thank you!
I have a very simple question:
myThread = Thread(target=TestTarget, args=(1, Event(),))
Is it possible to get the arguments just using the Variable myThread?
Thank you!
On
_Thread__args and _Thread__kwargs store the constructor's arguments.
However, as you might guess by the underscores, these are not part of the public API. Indeed, "mangled, renamed attributes" are intended to discourage direct access.
Additionally, these attributes are specific to the CPython implementation. Jython, for example, appears not to expose these attributes by those names (disclaimer: I did not test, instead just glanced at the source).
In your case, it would perhaps be better to store the arguments in some application-meaningful way in a subclass of Thread, and access those.
After pilcrows answer - i use this working solution:
Thank you all for helping!