[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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23162
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 sequences, which is a jarring inconsistency.

--
components: Library (Lib)
messages: 233399
nosy: Devin Jeanpierre
priority: normal
severity: normal
status: open
title: collections.abc sequences don't check identity before equality
versions: Python 3.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23162
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 rep...@bugs.python.org
http://bugs.python.org/issue23162
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 invariant, anything added to the sequence will be in the 
sequence.

That said, I don't know if this is really needed.

--
keywords: +patch
nosy: +rhettinger
priority: normal - low
type:  - behavior
Added file: http://bugs.python.org/file37596/sequence_identity.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23162
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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://bugs.python.org/issue23086

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23162
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 rep...@bugs.python.org
http://bugs.python.org/issue23162
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 rejected, I'll add a test patch to this issue too.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23162
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 rep...@bugs.python.org
http://bugs.python.org/issue23162
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com