[Python-ideas] Add new `Symbol` type
Eric V. Smith
eric at trueblade.com
Fri Jul 6 12:23:32 EDT 2018
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.
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.
Eric
More information about the Python-ideas
mailing list