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.
Created on 2011年09月11日 13:37 by nikratio, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (8) | |||
|---|---|---|---|
| msg143864 - (view) | Author: Nikolaus Rath (nikratio) * | Date: 2011年09月11日 13:37 | |
According to http://docs.python.org/library/threading.html#condition-objects, threading.Condition is a class. However, in fact it turns out to be function that constructs a _Condition instance. I don't know the reason for that, but it seems to me that either Condition should be a class, or the reason for it being a function should be documented so that people who I would like to inherit from Conditionknow if that is not supported, or if they can safely inherit from _Condition instead. |
|||
| msg143996 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2011年09月13日 23:41 | |
> According to http://docs.python.org/library/threading.html#condition-objects, threading.Condition is a class. Nope, it's a factory, and it's written in the doc: "threading.Condition() A factory function that returns a new condition variable object. A condition variable allows one or more threads to wait until they are notified by another thread. See Condition Objects." It has been changed in Python 3.3 (#10968): threading.Condition is now a class, instead of a factory. |
|||
| msg143998 - (view) | Author: Nikolaus Rath (nikratio) * | Date: 2011年09月13日 23:45 | |
On 09/13/2011 07:41 PM, STINNER Victor wrote: > > STINNER Victor <victor.stinner@haypocalc.com> added the comment: > >> According to http://docs.python.org/library/threading.html#condition-objects, threading.Condition is a class. > > Nope, it's a factory, and it's written in the doc: > > "threading.Condition() > A factory function that returns a new condition variable object. A condition variable allows one or more threads to wait until they are notified by another thread. > > See Condition Objects." Yes, but further down it still says: """ class threading.Condition([lock]) If the lock argument is given and not None, [....] """ Best, -Nikolaus |
|||
| msg144014 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2011年09月14日 08:29 | |
> Yes, but further down it still says: > > """ > class threading.Condition([lock]) > > If the lock argument is given and not None, [....] > """ What do you suggest? Replace it by class threading._Condition? |
|||
| msg144018 - (view) | Author: Eli Bendersky (eli.bendersky) * (Python committer) | Date: 2011年09月14日 09:36 | |
> What do you suggest? Replace it by class threading._Condition? -1 on this IMHO just documenting the situation as it is would make more sense |
|||
| msg144023 - (view) | Author: Nikolaus Rath (nikratio) * | Date: 2011年09月14日 13:16 | |
On 09/14/2011 04:29 AM, STINNER Victor wrote: > > STINNER Victor <victor.stinner@haypocalc.com> added the comment: > >> Yes, but further down it still says: >> >> """ >> class threading.Condition([lock]) >> >> If the lock argument is given and not None, [....] >> """ > > What do you suggest? Replace it by class threading._Condition? I don't have an optimal solution that would fit into the prescribed layout. I think the best we can do is keep calling it class threading Condition, but mention in the very first sentence that it isn't actually a class: class threading.Condition([lock]): threading.Condition is not actually a class but a factory function. The returned instance, however, is guaranteed to have the behaviour of a threading.Condition class as described here. If the lock argument... Best, -Nikolaus |
|||
| msg144212 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2011年09月17日 17:47 | |
I don't think this is important enough. It's now a class anyway in 3.3+. |
|||
| msg144215 - (view) | Author: Raymond Hettinger (rhettinger) * (Python committer) | Date: 2011年09月17日 18:24 | |
I recommend just closing this. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:21 | admin | set | github: 57169 |
| 2011年09月18日 09:38:32 | vstinner | set | status: open -> closed resolution: wont fix |
| 2011年09月17日 18:24:20 | rhettinger | set | nosy:
+ rhettinger messages: + msg144215 |
| 2011年09月17日 17:47:14 | georg.brandl | set | nosy:
+ georg.brandl messages: + msg144212 |
| 2011年09月15日 14:50:33 | eric.araujo | set | versions: - Python 2.6, Python 3.1, Python 3.3, Python 3.4 |
| 2011年09月14日 13:16:51 | nikratio | set | messages: + msg144023 |
| 2011年09月14日 09:36:04 | eli.bendersky | set | nosy:
+ eli.bendersky messages: + msg144018 |
| 2011年09月14日 08:29:14 | vstinner | set | messages: + msg144014 |
| 2011年09月13日 23:45:54 | nikratio | set | messages: + msg143998 |
| 2011年09月13日 23:41:31 | vstinner | set | nosy:
+ vstinner messages: + msg143996 |
| 2011年09月11日 13:37:15 | nikratio | create | |