Message358956
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 |
|
Date |
User |
Action |
Args |
2019-12-28 19:03:25 | xtreak | set | recipients:
+ xtreak, ronaldoussoren, ned.deily, leonardogalani |
2019-12-28 19:03:25 | xtreak | set | messageid: <1577559805.82.0.753792914498.issue39149@roundup.psfhosted.org> |
2019-12-28 19:03:25 | xtreak | link | issue39149 messages |
2019-12-28 19:03:25 | xtreak | create | |
|