
I'd like to learn about use cases where `...` (a.k.a. `Ellipsis`) is not a good sentinel. It's a pickable singleton testable with `is`, readily available, and extremely unlikely to appear in a data stream. Its repr is "Ellipsis". If you don't like the name for this purpose, you can always define a constant (that won't fix the `repr`, obviously, but helps with source code readability). SENTINEL = ... I can't think of any case where I'd rather have my own custom sentinel, or need a special API for sentinels. Probably my fault, of course. Please enlighten me! Cheers, Luciano On Thu, May 20, 2021 at 8:35 AM Victor Stinner <vstinner@python.org> wrote:
IMO you should consider writing a PEP to enhance sentinels in Python, and maybe even provide a public API for sentinels in general.
Victor _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/EY6B6PRQ... Code of Conduct: http://python.org/psf/codeofconduct/
-- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/0636920032519.do | Technical Principal at ThoughtWorks | Twitter: @ramalhoorg