[New-bugs-announce] [issue23986] Inaccuracy about "in" keyword for list and tuple
wim glenn
report at bugs.python.org
Fri Apr 17 09:22:58 CEST 2015
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 at python
components: Documentation
messages: 241317
nosy: docs at 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 <report at bugs.python.org>
<http://bugs.python.org/issue23986>
_______________________________________
More information about the New-bugs-announce
mailing list