This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xtreak
Recipients leonardogalani, ned.deily, ronaldoussoren, xtreak
Date 2019-12-28.19:03:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1577559805.82.0.753792914498.issue39149@roundup.psfhosted.org>
In-reply-to
Content
It's intended as non-empty strings evaluate to True so you with `'a' and 'b' and 'c' in dict` you are essentially evaluating `'a' and 'b' and ('c' in dict)` with brackets precedence i.e. `True and True and True` . On the other hand `'a' and 'g' and 'c' in dict` it's the same with 'g' evaluated to True. I guess you want to check all the keys are present where all is more readable. Some more answers here: https://stackoverflow.com/questions/1285911/how-do-i-check-that-multiple-keys-are-in-a-dict-in-a-single-pass

>>> all(char in dict for char in ['a', 'b', 'c'])
True
>>> all(char in dict for char in ['a', 'b', 'g'])
False
History
Date User Action Args
2019-12-28 19:03:25xtreaksetrecipients: + xtreak, ronaldoussoren, ned.deily, leonardogalani
2019-12-28 19:03:25xtreaksetmessageid: <1577559805.82.0.753792914498.issue39149@roundup.psfhosted.org>
2019-12-28 19:03:25xtreaklinkissue39149 messages
2019-12-28 19:03:25xtreakcreate