Mailing List Archive

[issue5031] Thread.daemon docs
New submission from steve21 <steve872929-bv@yahoo.com.au>:

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.)

----------
assignee: georg.brandl
components: Documentation
messages: 80361
nosy: georg.brandl, steve21
severity: normal
status: open
title: Thread.daemon docs
versions: Python 3.0

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5031>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue5031] Thread.daemon docs [ In reply to ]
Jesse Noller <jnoller@gmail.com> added the comment:

Attached is a patch to the docs which reflects the nature of the daemon
property based on trunk

----------
keywords: +needs review, patch
nosy: +jnoller
Added file: http://bugs.python.org/file12842/issue5031.patch

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5031>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue5031] Thread.daemon docs [ In reply to ]
Gabriel Genellina <gagsl-py2@yahoo.com.ar> added the comment:

"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 ..."""

----------
nosy: +gagenellina

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5031>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue5031] Thread.daemon docs [ In reply to ]
Jesse Noller <jnoller@gmail.com> added the comment:

> 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 ..."""

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5031>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue5031] Thread.daemon docs [ In reply to ]
Changes by Jesse Noller <jnoller@gmail.com>:


Removed file: http://bugs.python.org/file12842/issue5031.patch

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5031>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue5031] Thread.daemon docs [ In reply to ]
Jesse Noller <jnoller@gmail.com> added the comment:

Hows this Gabriel?

Added file: http://bugs.python.org/file12843/issue5031.patch

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5031>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue5031] Thread.daemon docs [ In reply to ]
Changes by Jesse Noller <jnoller@gmail.com>:


_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5031>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue5031] Thread.daemon docs [ In reply to ]
Jesse Noller <jnoller@gmail.com> added the comment:

Hows the new patch Gabriel?

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5031>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue5031] Thread.daemon docs [ In reply to ]
Gabriel Genellina <gagsl-py2@yahoo.com.ar> added the comment:

Looks fine to me. Bah, perhaps purists would write `daemon` =
``False`` , but I think the meaning is perfectly clear now.

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5031>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue5031] Thread.daemon docs [ In reply to ]
Changes by Jesse Noller <jnoller@gmail.com>:


Removed file: http://bugs.python.org/file12843/issue5031.patch

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5031>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue5031] Thread.daemon docs [ In reply to ]
Jesse Noller <jnoller@gmail.com> added the comment:

Then the patch I wrote before "correcting it" was more purist ;) I
preferred the `daemon` = ``False`` wording as well. Here's a corrected
patch.

Added file: http://bugs.python.org/file12846/issue5031.patch

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5031>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue5031] Thread.daemon docs [ In reply to ]
Georg Brandl <georg@python.org> added the comment:

Committed in r69301.

----------
resolution: -> fixed
status: open -> closed

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5031>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com