On Wed, Mar 1, 2017 at 1:56 PM, 语言破碎处 <mlet_it_...@126.com> wrote:
> I'm bited once:
>     >>> '' in {} == False
>     False
>     >>> ('' in {}) == False
>     True
>
>     # '' in {} == False ==>> ('' in {}) and ({} == False) ==>> False!
>
> I think only compare operations should be chained.

I do feel your pain, but generally, you shouldn't be using "== False"
to negate a condition. That's what the "not" operator is for - or
inverted conditions.

>>> '' not in {}
True

Much better. :)

ChrisA
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to