[issue23162] collections.abc sequences don't check identity before equality

2022-01-20 Thread Irit Katriel
Change by Irit Katriel : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Test identity first in membership operation of ItemsView, ValuesView and Sequence in collections.abc ___ Python tracker

[issue23162] collections.abc sequences don't check identity before equality

2015-01-04 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: I think that such a thing is meaningless, as I don't own copyright to the patches, my employer (Google) does. But, it can't hurt, so, done. -- ___ Python tracker ___

[issue23162] collections.abc sequences don't check identity before equality

2015-01-04 Thread Raymond Hettinger
Raymond Hettinger added the comment: Can you submit a contributor agreement as well? -- ___ Python tracker ___ ___ Python-bugs-list ma

[issue23162] collections.abc sequences don't check identity before equality

2015-01-04 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: Since both patches will clobber each other (same test method), complicating the review process, I've written the patch for issue23086 first. It's currently waiting on committee review from my employer. Will upload to other issue, and once it's submitted or r

[issue23162] collections.abc sequences don't check identity before equality

2015-01-04 Thread Raymond Hettinger
Raymond Hettinger added the comment: Devin, you're welcome to whip-up a patch for the tests for this one. I don't know if it will go forward though. I'm leaving it open for a while to see if anyone has objections. If you want to work another straight-forward ABC patch, have a look at http:/

[issue23162] collections.abc sequences don't check identity before equality

2015-01-04 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: Thanks for the patch! I was secretly hoping to write it though. :P Not sure how the code review tool works. The patch looks good to me, except it needs tests IMO. I can write them if you think this is not worth the effort. -- ___

[issue23162] collections.abc sequences don't check identity before equality

2015-01-04 Thread Raymond Hettinger
Raymond Hettinger added the comment: While this hasn't proven to be an issue to date (non-reflexive objects don't arise much in practice), the proposed change would make it easier to use the Sequence ABC to create classes that are interoperable with other sequences and that have the clean inva

[issue23162] collections.abc sequences don't check identity before equality

2015-01-04 Thread Devin Jeanpierre
Devin Jeanpierre added the comment: See Raymond Hettinger's comments in http://bugs.python.org/issue4296 for details on why the usual sequence behavior is deliberate. -- ___ Python tracker

[issue23162] collections.abc sequences don't check identity before equality

2015-01-04 Thread Devin Jeanpierre
New submission from Devin Jeanpierre: For sequence __contains__ and other scenarios, identity is checked before equality, which I've heard is so that "for x in y: assert x in y" doesn't ever fail with an AssertionError (even with NaN and so on). This is not the case for collections.abc-based s