On 7/9/2018 5:01 PM, Brett Cannon wrote:
On Fri, 6 Jul 2018 at 09:24 Eric V. Smith <e...@trueblade.com
<mailto:e...@trueblade.com>> 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.
Good to know. Thanks.
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?
I think so. I'd hate to import unittest.mock just to get a sentinel
object for dataclasses.
Eric
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/