Steven D'Aprano <[email protected]> added the comment:
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.
----------
nosy: +steven.daprano
type: behavior -> enhancement
versions: -Python 3.6, Python 3.7, Python 3.8, Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue43929>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com