This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients serhiy.storchaka, vstinner
Date 2020-09-22.14:32:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1600785123.31.0.664198699481.issue41833@roundup.psfhosted.org>
In-reply-to
Content
> 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()}"
History
Date User Action Args
2020-09-22 14:32:03vstinnersetrecipients: + vstinner, serhiy.storchaka
2020-09-22 14:32:03vstinnersetmessageid: <1600785123.31.0.664198699481.issue41833@roundup.psfhosted.org>
2020-09-22 14:32:03vstinnerlinkissue41833 messages
2020-09-22 14:32:03vstinnercreate