
On Sat, Sep 10, 2022 at 3:35 PM Chris Angelico <rosuav@gmail.com> wrote:
On Sat, 10 Sept 2022 at 22:21, Tal Einat <taleinat@gmail.com> wrote:
Hello,
I've been working on this PEP [1] on and off for over a year. I think it is now nearly ready for submission to the steering council.
From the expectations on sentinels:
The sentinel objects should behave as expected by a sentinel object: When compared using the is operator, it should always be considered identical to itself but never to any other object.
That would be intrinsically true of ANY object. Did you mean the "==" operator? (You mention further down that equality should behave that way, but that identity checks are recommended.)
Yes, I should likely clarify that, thanks for bringing this up! The current design is that sentinels with the same name from the same module will always be identical. So for example `Sentinel("name") is Sentinel("name")` will be true. This allows surviving copying, pickling + unpickling, etc. On the other hand, sentinels with the same name defined in different modules will be different. Other existing implementations of sentinels differ in this respect, in ways that can be surprising IMO.
Otherwise, looks decent.
Thanks for this input too! - Tal