Message391774
This is not a bug fix, it is a change of behaviour ("enhancement"). All of 3.6 through 3.9 are in feature freeze. 3.10 is probably in feature freeze, but if not it is extremely close to it. So this can only go into 3.11 and (maybe) 3.10.
But I don't think this is a good enhancement. I am sorry that you keep making the mistake of wrongly assuming that you can use threading Events that way, but your mistake is not necessarily a flaw in the object.
Is there anything in the documentation that leads you to believe that Events are intended to be used that way?
The basic object model of Python is that all objects can be duck-typed as bools, that is they are either truthy or falsey. Values which represent "nothing" in some sense (empty containers, zero numbers, None) should evaluate as False; values which represent "something" (non-empty containers, non-zero numbers, arbitrary objects) should evaluate as True. This model goes back to the earliest days of Python 1.x before we even had a bool type or True and False singletons, and 1 and 0 where used instead.
`bool(obj)` is a fundamental operation, like `print(obj)`, which should never fail.
You say: "the intention behind bool(event) is ambiguous" but I don't believe that is correct. Unless documented differently, the intention behind bool(event) is:
- events are not containers;
- or numbers;
- but they are "things" (objects);
- and so they should evaluate as True.
So unless you can provide evidence for this ambiguity, or evidence that many other people make this same mistake, I will recommend this issue be closed. |
|
Date |
User |
Action |
Args |
2021-04-24 12:20:39 | steven.daprano | set | recipients:
+ steven.daprano, sarf, aa1371 |
2021-04-24 12:20:39 | steven.daprano | set | messageid: <1619266839.85.0.64906515796.issue43929@roundup.psfhosted.org> |
2021-04-24 12:20:39 | steven.daprano | link | issue43929 messages |
2021-04-24 12:20:39 | steven.daprano | create | |
|