On 01/03/17 02:56, 语言破碎处 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 think comparing against False (or True) is bad id
OK, I'm impressed!
I've written about and taught Python for almost 20 years. I never realized
`in` was a chained comparison. I'm pretty sure I've never seen it used
that way "in the wild." I also never tried using `is` in a chained way
until just now.
That said, there are at least three things
On Wed, Mar 1, 2017 at 1:56 PM, 语言破碎处 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