Re: Coming In Python 3.15: Sentinel Values

2026-05-11 Thread Jon Ribbens via Python-list
On 2026-05-11, Lawrence D’Oliveiro wrote: > On Sun, 10 May 2026 21:01:00 -0700, Paul Rubin wrote: >> Lawrence D’Oliveiro writes: >>> For those times when a simple “None” marker element is not >>> sufficient, this will be very convenient. >> >> object() has always worked for me. > > I have done th

Re: Coming In Python 3.15: Sentinel Values

2026-05-11 Thread Rob Cliffe via Python-list
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__. I

Re: Coming In Python 3.15: Sentinel Values

2026-05-11 Thread Chris Angelico via Python-list
On Tue, 12 May 2026 at 09:06, Rob Cliffe via Python-list 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

Re: Coming In Python 3.15: Sentinel Values

2026-05-11 Thread Chris Angelico via Python-list
On Tue, 12 May 2026 at 09:35, Chris Angelico wrote: > > On Tue, 12 May 2026 at 09:06, Rob Cliffe via Python-list > 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

Re: Coming In Python 3.15: Sentinel Values

2026-05-11 Thread Rob Cliffe via Python-list
On 12/05/2026 00:35, Chris Angelico wrote: On Tue, 12 May 2026 at 09:06, Rob Cliffe via Python-list 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 s

Re: Coming In Python 3.15: Sentinel Values

2026-05-11 Thread Chris Angelico via Python-list
On Tue, 12 May 2026 at 09:52, Rob Cliffe wrote: > Do I need to install Python 3.15 to try it? > I did try it (before posting) with Python 3.13, using the outline > implementation from the PEP; > it allowed me to create 2 sentinels but failed when I tried > pickle.dumps on the first one with > _pi

Re: Coming In Python 3.15: Sentinel Values

2026-05-11 Thread Rob Cliffe via Python-list
On 12/05/2026 00:39, Chris Angelico via Python-list wrote: On Tue, 12 May 2026 at 09:35, Chris Angelico wrote: On Tue, 12 May 2026 at 09:06, Rob Cliffe via Python-list wrote: I've read PEP 661 and I have a question - can anybody answer it? The PEP makes clear that any call to sentinel() wil

Re: Coming In Python 3.15: Sentinel Values

2026-05-11 Thread Richard Damon
On 05/11/2026 8:29 PM EDT Rob Cliffe via Python-list <[1][email protected]> wrote: On 12/05/2026 00:39, Chris Angelico via Python-list wrote: On Tue, 12 May 2026 at 09:35, Chris Angelico <[2][email protected]> wrote: On Tue, 12 May 2026 at 09:06, Rob Cliffe via Python

Re: Coming In Python 3.15: Sentinel Values

2026-05-11 Thread Tim Daneliuk via Python-list
On 5/10/26 19:17, Lawrence D’Oliveiro wrote: A new feature coming in Python 3.15 is the “sentinel” class, useful for creating custom values to mark the end of sequences of items, that kind of thing ,