Issue 24256: threading.Timer is not a class (original) (raw)

Created on 2015-05-21 06:29 by jrunyon, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
function_threading_timer.diff angad,2015-07-04 08:58 review
timer.diff jrunyon,2015-11-17 12:02
Messages (7)
msg243735 - (view) Author: John Runyon (jrunyon) * Date: 2015-05-21 06:29
the documentation (https://docs.python.org/2/library/threading.html#threading.Timer) lists "threading.Timer" as a class. It is not, which means that (for example) you can not use it in isinstance(). "threading._Timer" is a class. "threading.Timer(...).__class__" is a class. "threading.Timer" is a function. >>> import threading >>> threading.Timer <function Timer at 0x7f99cae23848>
msg243736 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2015-05-21 06:44
This is really a duplicate of Issue5831 which ended up being closed as a duplicate of Issue10968. The resolution of the latter issue was to change threading.Timer in Python 3.3 to actually be a class, a new feature. But it appears that along the way the issue of correcting the documentation for 2.7 was never addressed. Perhaps you could propose wording for a documentation patch?
msg243744 - (view) Author: John Runyon (jrunyon) * Date: 2015-05-21 10:54
Concise documentation isn't my forte, but my confusion would've been avoided with a note that "for historical reasons, threading.Timer is actually a factory function for the underlying class threading._Timer" or something along those lines.
msg246245 - (view) Author: Angad Singh (angad) * Date: 2015-07-04 08:58
Taking a stab at this. Attached patch.
msg246267 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-07-04 17:38
Thanks, but we don't want to document an "internal only" name (which is what the leading underscore means in this case). It might be desirable to note that the name is a class in python3, I'm not sure.
msg254798 - (view) Author: John Runyon (jrunyon) * Date: 2015-11-17 12:02
New proposed patch. I understand not wanting to document an "internal only name", except that in this case it rather needs to be documented. I would strongly prefer Angad's patch to mine because you do, at times, need to know the actual name of the class being used -- and the documentation should not force people to dig through the source code to find that.
msg370442 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-05-31 13:22
Python 2.7 is no longer supported.
History
Date User Action Args
2022-04-11 14:58:17 admin set github: 68444
2020-05-31 13:22:52 serhiy.storchaka set status: open -> closednosy: + serhiy.storchakamessages: + resolution: out of datestage: needs patch -> resolved
2015-11-17 12:02:56 jrunyon set files: + timer.diffmessages: +
2015-07-04 17:38:52 r.david.murray set nosy: + r.david.murraymessages: +
2015-07-04 08:58:39 angad set files: + function_threading_timer.diffnosy: + angadmessages: + keywords: + patch
2015-05-21 10:54:53 jrunyon set messages: +
2015-05-21 06:44:41 ned.deily set nosy: + ned.deilymessages: + stage: needs patch
2015-05-21 06:29:41 jrunyon create