[issue23987] docs about containers membership testing wrong for broken objects

2020-11-18 Thread Peter Nowee
Change by Peter Nowee : -- nosy: +peternowee ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue23987] docs about containers membership testing wrong for broken objects

2019-08-22 Thread Raymond Hettinger
Raymond Hettinger added the comment: It looks like the identity-implies-equality part of this has already been taken care of. The __hash__ invariant also appears to now have extensive coverage, some in the glossary and much more in the data model section of the reference. Cute puzzles

[issue23987] docs about containers membership testing wrong for broken objects

2015-07-21 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: -ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23987 ___ ___ Python-bugs-list

[issue23987] docs about containers membership testing wrong for broken objects

2015-04-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: There is a separate report for taking care of the identity check for contains: https://bugs.python.org/issue23986 I think notes about crazy hashes shouldn't spill all over our docs. At best, it warrants a FAQ entry about how hash tables work. The risk

[issue23987] docs about containers membership testing wrong for broken objects

2015-04-20 Thread R. David Murray
R. David Murray added the comment: Yes, that's what I had in mind. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23987 ___ ___ Python-bugs-list

[issue23987] docs about containers membership testing wrong for broken objects

2015-04-20 Thread Ethan Furman
Ethan Furman added the comment: So something like: For container types such as list, tuple, or collections.deque, the expression 'x in y' is equivalent to 'any(x is e or x == e for e in y)'. For container types such as set, frozenset, and dict, this equivalence expression is modified by the

[issue23987] docs about containers membership testing wrong for broken objects

2015-04-17 Thread Jonathan Sharpe
Jonathan Sharpe added the comment: I don't think it's as simple as linking to the hashable definition. The equivalent expression is simply wrong for dict/set/frozenset, as those types check hash equality, not identity. -- ___ Python tracker

[issue23987] docs about containers membership testing wrong for broken objects

2015-04-17 Thread Ethan Furman
New submission from Ethan Furman: 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

[issue23987] docs about containers membership testing wrong for broken objects

2015-04-17 Thread Jonathan Sharpe
Changes by Jonathan Sharpe j.r.sharpe+pyt...@gmail.com: -- assignee: - docs@python components: +Documentation nosy: +docs@python, jonrsharpe ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23987

[issue23987] docs about containers membership testing wrong for broken objects

2015-04-17 Thread Ethan Furman
Ethan Furman added the comment: It's not quite that simple -- those containers use the hash to find the objects that will be first checked by identity, and then equality* -- otherwise they would have to do a complete scan from first key to last, and that would kill performance. ... Okay, I

[issue23987] docs about containers membership testing wrong for broken objects

2015-04-17 Thread Ethan Furman
Ethan Furman added the comment: I think I like that better than my suggestion. :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23987 ___ ___

[issue23987] docs about containers membership testing wrong for broken objects

2015-04-17 Thread R. David Murray
R. David Murray added the comment: Could we add For dictionaries and sets this equivalence expression is modified by the addition of 'if hash(x) == hash(e)'? -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org