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 ethan.furman
Recipients eric.araujo, ethan.furman, ezio.melotti, georg.brandl
Date 2015-04-17.08:09:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1429258165.63.0.284734084008.issue23987@psf.upfronthosting.co.za>
In-reply-to
Content
https://docs.python.org/3/reference/expressions.html#comparisons:
----------------------------------------------------------------
The operators 'in' and 'not in' test for membership. 'x in s' evaluates to true if x is a member of s, and false otherwise. 'x not in s' returns the negation of 'x in s'. All built-in sequences and set types support this as well as dictionary, for which 'in' tests whether the dictionary has a given key. For container types such as list, tuple, set, frozenset, dict, or collections.deque, the expression 'x in y' is equivalent to 'any(x is e or x == e for e in y)'.

StackOverflow question for context: http://stackoverflow.com/q/29692140/208880

Summary:  if a user creates a broken object such that __hash__ returns a random number with every invocation, then that object will get lost in a dict or set; but the above statement about 'equivalent to' claims that such an object will still be found.

On the other hand, https://docs.python.org/3/glossary.html#term-hashable says that a constant return value is required for an object to be hashable (of course, Python can't tell if future calls to __hash__ will return the same value).

Perhaps a link to the #term-hashable would be appropriate?
History
Date User Action Args
2015-04-17 08:09:25ethan.furmansetrecipients: + ethan.furman, georg.brandl, ezio.melotti, eric.araujo
2015-04-17 08:09:25ethan.furmansetmessageid: <1429258165.63.0.284734084008.issue23987@psf.upfronthosting.co.za>
2015-04-17 08:09:25ethan.furmanlinkissue23987 messages
2015-04-17 08:09:25ethan.furmancreate