Issue5831
Created on 2009-04-24 13:42 by maxenced, last changed 2022-04-11 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| threading.Issue.5831.patch | humitos, 2009-09-04 17:42 | review | ||
| Messages (7) | |||
|---|---|---|---|
| msg86409 - (view) | Author: Maxence (maxenced) | Date: 2009-04-24 13:42 | |
In the documentation, the Timer() function of the threading class is described as a class. however, it's a function : >>> import threading >>> threading.Timer <function Timer at 0x967495c> Cheers Maxence |
|||
| msg86413 - (view) | Author: R. David Murray (r.david.murray) * ![]() |
Date: 2009-04-24 15:00 | |
The Timer function is a simple wrapper for creating an instance of the _Timer class. The Timer class was proposed in Issue428326 by Itamar and applied by Martin in r22972. In the original patch the class was exposed as Timer. Martin's commit introduced the Timer function and _Timer class name. The documentation provided by Itamar was not updated to match. The change would appear to intentionally make it difficult to create Timer subclasses. The Timer function/class was added in 2001 and there are no complaints that Thread can't be subclassed in the tracker. So perhaps a doc patch is appropriate...but that would leave Timer with a name that is not PEP 8 compliant. I think I'd prefer deleting the function and naming the class Timer, so that it has a PEP 8 compliant name. It seems unlikely that any user code would depend on Timer being a function. Martin, do you have any memory of why you made Timer a function? Was it just that it would be pretty pointless to subclass it? |
|||
| msg92260 - (view) | Author: Manuel Kaufmann (humitos) * | Date: 2009-09-04 17:42 | |
I deleted this function and I renamed the class _Timer to Timer. I attached the patch |
|||
| msg121387 - (view) | Author: Éric Araujo (eric.araujo) * ![]() |
Date: 2010-11-17 22:31 | |
Nearly all classes in threading uses this function/class indirection, which I don’t understand (except for RLock, which is a factory function). |
|||
| msg126848 - (view) | Author: Éric Araujo (eric.araujo) * ![]() |
Date: 2011-01-22 18:32 | |
Explanation has been provided on #10968, and hopefully the code will be cleaned up. Closing as superseded. |
|||
| msg128587 - (view) | Author: Martijn van Oosterhout (Martijn.van.Oosterhout) | Date: 2011-02-15 12:07 | |
Note this is a behaviour change. Under the old scheme (Foo is a class) Foo.timerclass = Timer created a method, whereas now it will just assign the class as an attribute. To work around this you had to use _Timer. Will that dummy class remain as an alias to avoid breaking code (in 2.7 at least)? |
|||
| msg128595 - (view) | Author: R. David Murray (r.david.murray) * ![]() |
Date: 2011-02-15 13:23 | |
Discussion should be moved to #10968, please. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:56:48 | admin | set | github: 50081 |
| 2011-02-15 13:23:18 | r.david.murray | set | nosy:
loewis, georg.brandl, humitos, eric.araujo, keldonin, r.david.murray, maxenced, Martijn.van.Oosterhout messages: + msg128595 |
| 2011-02-15 12:07:30 | Martijn.van.Oosterhout | set | nosy:
+ Martijn.van.Oosterhout messages: + msg128587 |
| 2011-01-22 18:32:29 | eric.araujo | set | status: open -> closed nosy: loewis, georg.brandl, humitos, eric.araujo, keldonin, r.david.murray, maxenced messages: + msg126848 superseder: threading.Timer should be a class so that it can be derived |
| 2010-11-17 22:31:21 | eric.araujo | set | versions:
+ Python 3.2, - Python 2.6, Python 3.0 nosy: + eric.araujo messages: + msg121387 assignee: docs@python -> |
| 2010-10-29 10:07:21 | admin | set | assignee: georg.brandl -> docs@python |
| 2009-09-04 17:42:40 | humitos | set | files:
+ threading.Issue.5831.patch nosy:
+ humitos keywords: + patch |
| 2009-04-25 07:38:37 | keldonin | set | nosy:
+ keldonin |
| 2009-04-24 15:00:04 | r.david.murray | set | priority: low components:
+ Library (Lib) messages: + msg86413 |
| 2009-04-24 13:42:36 | maxenced | create | |
