On Tue, 12 May 2026 at 09:35, Chris Angelico <[email protected]> wrote: > > On Tue, 12 May 2026 at 09:06, Rob Cliffe via Python-list > <[email protected]> wrote: > > > > I've read PEP 661 and I have a question - can anybody answer it? > > The PEP makes clear that any call to sentinel() will return a fresh > > sentinel object - even if it is called twice with the same string parameter. > > It states that sentinel objects have two public attributes: __name__ and > > __module__. > > It also states that pickling and unpickling a sentinel will return the > > same object: > > MISSING = sentinel('MISSING') > > assert pickle.loads(pickle.dumps(MISSING)) is MISSING
Oh, and to clarify: both PEP 661 and the active docs at https://docs.python.org/3.15/library/functions.html#sentinel do describe the behaviour of pickling, defining exactly why you can't get the confusion you're describing. ChrisA -- https://mail.python.org/mailman3//lists/python-list.python.org
