On Fri, 6 Jul 2018 at 09:24 Eric V. Smith <[email protected]> wrote:

> On 7/6/2018 11:20 AM, Flavio Curella wrote:
> > I think this thread can be resolved as 'used unittest.mock.sentinel'. It
> > doesn't have 'global sentinels', but I'm not convinced they are actually
> > necessary, since `mock.sentinel` objects with the same name compare as
> > equal. Thanks to Nathaniel, I now understand that JS has global symbols
> > for historical reasons that we don't have, and I'm not convinced of
> > their usefulness.
>
> Do all Python distributions ship with unittest.mock? I see to recall
> that Debian and/or Ubuntu strips out part of the normal distribution.
>

It's usually tkinter and such, not unittest stuff from my understanding.


>
> For example, dataclasses.py has a sentinel, and it includes some code to
> get a more helpful repr. It would make sense to re-use the
> unittest.mock.sentinel code, but not if that code isn't always
> guaranteed to be present.
>

Would it make sense to abstract this out to the 'types'  to have a single
'types.sentinel' object for those rare cases that Guido pointed out?
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to