True == 1 weirdness

Jussi Piitulainen harvesting at makes.email.invalid
Thu Sep 17 09:06:37 CEST 2015


Gregory Ewing writes:

> My problem is that I find it difficult to remember that Python
> considers 'in' to be a comparison operator.
>
> To me, comparison is something you do between things of the same kind,
> whereas 'in' is a relationship between things of different
> kinds. Calling it a comparison is like comparing apples and
> oranges. Or apples and baskets of apples, or something.

Ordinary binary operators not only combine things of the same type, they
also produce a thing of that same type. So 'in' does not fit among them
either.

I feel it's _more_ at home among comparison operators. (Hm. That's
'operator' in a different sense.)


More information about the Python-list mailing list