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.

classification
Title: Thread.daemon docs
Type: Stage:
Components: Documentation Versions: Python 3.0
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: georg.brandl, ggenellina, jnoller, steve21
Priority: normal Keywords: needs review, patch

Created on 2009-01-22 09:26 by steve21, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue5031.patch jnoller, 2009-01-24 18:41
Messages (8)
msg80361 - (view) Author: Steve (steve21) Date: 2009-01-22 09:26
In the threading module the Thread.daemon documentation says:

"The thread’s daemon flag. This must be set before start() is called,
otherwise RuntimeError is raised.

    The initial value is inherited from the creating thread.

    The entire Python program exits when no alive non-daemon threads are
left."

I think the docs should state Thread.daemon's type (boolean, or integer,
or something else?) and its default value (when you have not set .daemon
in the creating thread.)
msg80414 - (view) Author: Jesse Noller (jnoller) * (Python committer) Date: 2009-01-23 14:23
Attached is a patch to the docs which reflects the nature of the daemon 
property based on trunk
msg80425 - (view) Author: Gabriel Genellina (ggenellina) Date: 2009-01-24 00:28
"This is a boolean value, and is False by default."

Not true; the next sentence in the description explains where the 
default value comes from.

I'd join both paragraphs to make it more clear:

"""A boolean value indicating whether this thread is a daemon thread 
(True) or not (False). This must be set before start() is called, 
otherwise RuntimeError is raised. Its initial value is inherited from 
the creating thread; the main thread is not a daemon thread.

The entire Python program exits ..."""
msg80426 - (view) Author: Jesse Noller (jnoller) * (Python committer) Date: 2009-01-24 00:54
> Not true; the next sentence in the description explains where the
> default value comes from.

Hmm, unless your threads are spawned by daemonized threads; the value
always defaults to false. That's why I said it defaults to False. Hows
this:

"""A boolean value indicating whether this thread is a daemon thread
(True) or not (False). This must be set before start() is called,
otherwise RuntimeError is raised. Its initial value is inherited from
the creating thread; the main thread is not a daemon thread therefore
all threads created in the main thread default to daemon = False.

The entire Python program exits ..."""
msg80429 - (view) Author: Jesse Noller (jnoller) * (Python committer) Date: 2009-01-24 01:00
Hows the new patch Gabriel?
msg80431 - (view) Author: Gabriel Genellina (ggenellina) Date: 2009-01-24 01:20
Looks fine to me. Bah, perhaps purists would write `daemon` = 
``False`` , but I think the meaning is perfectly clear now.
msg80467 - (view) Author: Jesse Noller (jnoller) * (Python committer) Date: 2009-01-24 18:41
Then the patch I wrote before "correcting it" was more purist ;) I 
preferred the `daemon` = ``False`` wording as well. Here's a corrected 
patch.
msg81209 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2009-02-05 11:40
Committed in r69301.
History
Date User Action Args
2022-04-11 14:56:44adminsetgithub: 49281
2009-02-05 11:40:47georg.brandlsetstatus: open -> closed
resolution: fixed
messages: + msg81209
2009-01-24 18:41:21jnollersetfiles: + issue5031.patch
messages: + msg80467
2009-01-24 18:41:10jnollersetfiles: - issue5031.patch
2009-01-24 01:20:15ggenellinasetmessages: + msg80431
2009-01-24 01:00:07jnollersetmessages: + msg80429
2009-01-24 00:59:55jnollersetmessages: - msg80428
2009-01-24 00:59:43jnollersetfiles: + issue5031.patch
messages: + msg80428
2009-01-24 00:59:11jnollersetfiles: - issue5031.patch
2009-01-24 00:54:05jnollersetmessages: + msg80426
2009-01-24 00:29:01ggenellinasetnosy: + ggenellina
messages: + msg80425
2009-01-23 14:23:31jnollersetkeywords: + patch, needs review
files: + issue5031.patch
messages: + msg80414
nosy: + jnoller
2009-01-22 09:26:28steve21create