[issue23986] Inaccuracy about "in" keyword for list and tuple

2016-04-26 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue23986] Inaccuracy about "in" keyword for list and tuple

2016-04-26 Thread Roundup Robot

Roundup Robot added the comment:

New changeset aba647a34ed4 by Raymond Hettinger in branch '2.7':
Issue #23986:  Note that the in-operator for lists and tuples check identity 
before equality.
https://hg.python.org/cpython/rev/aba647a34ed4

--
nosy: +python-dev

___
Python tracker 

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



[issue23986] Inaccuracy about "in" keyword for list and tuple

2016-01-03 Thread Ezio Melotti

Changes by Ezio Melotti :


--
stage:  -> patch review

___
Python tracker 

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



[issue23986] Inaccuracy about "in" keyword for list and tuple

2015-04-19 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I'll add James' suggested wording, but with the reversed-order suggested by 
David Murray.

--
assignee: docs@python -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue23986] Inaccuracy about "in" keyword for list and tuple

2015-04-17 Thread R. David Murray

R. David Murray added the comment:

Those two should be in the reverse order, though.  Identity is checked before 
equality.  But why not backport the python3 wording?  (Note that there is an 
open issue for slightly improving that wording).

--
nosy: +r.david.murray

___
Python tracker 

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



[issue23986] Inaccuracy about "in" keyword for list and tuple

2015-04-17 Thread James Edwards

James Edwards added the comment:

What about:

 For the list and tuple types, ``x in y`` is true if and only if there exists an
-index *i* such that ``x == y[i]`` is true.
+index *i* such that either ``x == y[i]`` or ``x is y[i]`` is true.

Seems to address your issue, and match the semantics of the Python3 any() 
approach.

--
keywords: +patch
nosy: +jedwards
Added file: http://bugs.python.org/file39087/issue23986.diff

___
Python tracker 

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



[issue23986] Inaccuracy about "in" keyword for list and tuple

2015-04-17 Thread wim glenn

New submission from wim glenn:

The comparisons section of the python 2 docs says:

--- 

https://docs.python.org/2/reference/expressions.html#comparisons

For the list and tuple types, x in y is true if and only if there exists an 
index i such that x == y[i] is true.

---

But it's not strictly speaking correct.  Simplest counter-example:

x = float('nan')
y = [x]

The python 3 docs instead mention correct equivalent which is 

any(x is e or x == e for e in y)

--
assignee: docs@python
components: Documentation
messages: 241317
nosy: docs@python, wim.glenn
priority: normal
severity: normal
status: open
title: Inaccuracy about "in" keyword for list and tuple
type: enhancement
versions: Python 2.7

___
Python tracker 

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