On Sat, Sep 10, 2022 at 3:35 PM Chris Angelico <[email protected]> wrote:
>
> On Sat, 10 Sept 2022 at 22:21, Tal Einat <[email protected]> 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
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/2U2IERQQB4XT6GPW5AQNG6PUMSGR53UK/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to