This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients Vlastimil.Zíma, michael.foord, peter.otten, r.david.murray
Date 2014-02-28.22:39:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1393627177.04.0.31988049519.issue20804@psf.upfronthosting.co.za>
In-reply-to
Content
Yes, exactly, you don't use is for equality comparison.  It tests object identity, which is why it makes sense to use it with a sentinel.

The 'name' of the sentinel is purely a way to store and retrieve particular sentinel objects.  The sentinel itself does not have a name.

Good point about copy...the copy protocol and the pickle protocol are closely related, so preventing a sentinel from being pickled may prevent it from being copied as well.  It is an interesting question how surprising people will find it for a sentinel to throw an error if an attempt is made to copy it, but if the test is using a sentinel, presumably it expects the sentinel to survive unchanged, so an error on copy is probably a reasonable result.  You could imagine someone wanting to use a sentinel to test that copy happens by making sure they get back a different object, though, so it is not entirely clear cut.  However, I expect that to be *much* less common than wanting to use it to prove that an object is preserved (not copied).
History
Date User Action Args
2014-02-28 22:39:37r.david.murraysetrecipients: + r.david.murray, peter.otten, michael.foord, Vlastimil.Zíma
2014-02-28 22:39:37r.david.murraysetmessageid: <1393627177.04.0.31988049519.issue20804@psf.upfronthosting.co.za>
2014-02-28 22:39:37r.david.murraylinkissue20804 messages
2014-02-28 22:39:36r.david.murraycreate