STINNER Victor <[email protected]> added the comment:
> And what if run different threads with the same target or with different
> targets with the same name?
If multiple Thread objects using the same target (or different targets with the
same name), they all get the same name using my PR 22357.
> Would not "Thread-3" be more useful in this case?
Well, that's an open question. In my experience, "Thread" name is pretty
useless.
What if I modify my PR to add "-{counter}" (ex: "func-3" for
target.__name__="func") to the default name? Reuse _counter().
Pseudo-code:
self._name = str(name)
try:
base_name = target.__name__
except AttributeError:
base_name = "Thread"
if not self._name:
self._name = "{base_name)-{_counter()}"
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue41833>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com