We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
GitHub fields:
assignee = None closed_at = <Date 2012-03-10.18:11:06.673> created_at = <Date 2012-03-10.18:01:02.115> labels = ['invalid'] title = '"in" operator doesn\'t return boolean' updated_at = <Date 2012-03-10.18:11:06.671> user = 'https://bugs.python.org/DamjanKoir'
bugs.python.org fields:
activity = <Date 2012-03-10.18:11:06.671> actor = 'georg.brandl' assignee = 'none' closed = True closed_date = <Date 2012-03-10.18:11:06.673> closer = 'georg.brandl' components = ['None'] creation = <Date 2012-03-10.18:01:02.115> creator = 'Damjan.Ko\xc5\xa1ir' dependencies = [] files = [] hgrepos = [] issue_num = 14247 keywords = [] message_count = 2.0 messages = ['155329', '155332'] nosy_count = 2.0 nosy_names = ['georg.brandl', 'Damjan.Ko\xc5\xa1ir'] pr_nums = [] priority = 'normal' resolution = 'not a bug' stage = None status = 'closed' superseder = None type = None url = 'https://bugs.python.org/issue14247' versions = ['Python 2.7']
The text was updated successfully, but these errors were encountered:
In operator acts like it doesn't return a boolean value
>>> 3 in [1,2,3] == True False
and even
>>> 3 in [1,2,3] == 3 in [1,2,3] False
but somehow if you add ( ) it starts working
>>> (3 in [1,2,3]) == True True
Tested on OSX 10.7 Python 2.7.1
Sorry, something went wrong.
Chaining comparison operators inserts implicit "and" conditions:
a OP b OP c OP d
is equivalent to
(a OP b) and (b OP c) and (c OP d)
This is most useful with ==, <, <= and so forth, but "in" and "is" also count as comparison ops and have the same precedence.
No branches or pull requests
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: