Closed GoogleCodeExporter closed 9 years ago
The whole point of sentinel is that you create unique objects that can be
compared on identity - the name is just a convenient way to create them and
have a useful repr. Under what circumstances are you getting sentinels with the
same name but a different identity?
Original comment by fuzzyman
on 21 Aug 2011 at 1:26
Well, if you print the sentinel object you don't actually see the identity,
just the name, so the error that I got was pretty confusing/non-obvious. After
drilling down I found something like <Sentinel name="foo"> != <Sentinel
name="foo">. The root issue was that in the custom test handler suite that I
inherited, the handler setup had a separate call to Sentinel() for some items.
I'm pretty sure that that's wrong (duh), but the patch above would have saved
me an hour or two of head scratching.
Alternatively, adding the id to the __str__/__repr__ might be a different way
to solve the same problem, so that it's obvious that the objects are different
ones but with the same name. Or else hide/don't export the base Sentinel object
so that people can't instantiate it themselves.
Original comment by anthony....@gmail.com
on 22 Aug 2011 at 1:01
The Sentinel class is not in __all__ and is not documented, and yes - using it
like that defeats the purpose of Sentinel! I can rename it to _Sentinel to make
it clear it is internal though.
Original comment by fuzzyman
on 6 Oct 2011 at 10:25
Committed in Revision c9c03e6c0a.
Original comment by fuzzyman
on 6 Oct 2011 at 10:31
Original issue reported on code.google.com by
anthony....@gmail.com
on 17 Aug 2011 at 4:48