Chris Angelico writes: > On Fri, Sep 18, 2015 at 4:49 AM, Ian Kelly wrote: >> On Thu, Sep 17, 2015 at 1:06 AM, Jussi Piitulainen >> wrote: >>> 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.) >> >> Comparison operators *are* binary operators. All that "binary" means >> is that it takes two arguments. > > I think what Jussi is saying is that int+int yields int, and > float*float yields float, and so on - but even that is true only of > the arithmetic operators, and not all of them (int/int -> float in > Py3). But generalizing from "arithmetic operators" to "ordinary > operators" is a little unfair, unless you assume that the sole purpose > of programming is to represent algebra.
Yes, that's what I was trying to say, though I should have used the word "operation" not "operator". The operators that denote something like operations are routinely used to feed their values back to the same or related operations; doing that with truth-valued operators does not often make sense; their results are combined with and, or, and not instead. I can easily make up special cases myself, but now I'm trying to think of typical uses and say that Python got this quite right. -- https://mail.python.org/mailman/listinfo/python-list