[Python-ideas] Add new `Symbol` type

Michael Foord fuzzyman at gmail.com
Fri Jul 6 04:36:39 EDT 2018


On Fri, 6 Jul 2018 at 07:30, Steven D'Aprano <steve at pearwood.info> wrote:

> On Thu, Jul 05, 2018 at 02:38:47PM -0500, Flavio Curella wrote:
> > More than once I've found myself wanting to create a 'sentinel' value.
> The
> > most common use case is to differentiate between an argument that has not
> > been provided, and an argument provided with the value `None`.
> [...]
> > Is this something that the Python community is interested in? I'm willing
> > to write the PEP
>
> I'm definitely interested, and coincidentally I started writing my own
> Symbol class a week or two ago (but put it aside unfinished due to other
> commitments) but honestly after four months of the assignment expression
> PEP I'm suffering from battle fatigue. It would be nice to have a break
> from controversial PEPs and catch my breath :-)
>

unittest.mock includes a sentinel object, with nice repr.

>>> from unittest.mock import sentinel
>>> sentinel.Foo
sentinel.Foo

Michael


>
> --
> Steve
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-- 

http://www.michaelfoord.co.uk/

May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180706/28fb0e53/attachment-0001.html>


More information about the Python-ideas mailing list