|
|
|
|
|
by zahlman
337 days ago
|
|
>and for me the surprising thing here is not "chained comparisons are weird" but rather "`in` is a comparison operator." Python documentation calls it a "comparison operator" (https://docs.python.org/3/reference/expressions.html#compari...) but a broader, better term is "relational operator". It expresses a possible relationship between two arguments, and evaluates whether those arguments have that relationship. In this case, "containment" (which intuitively encompasses set membership and substrings). A finer distinction could have been made, arguably, but it's far too late to change now. (And everyone is traumatized by the 2->3 transition.) |
|