Search code examples
pythonmathsyntaxterminology

Is there a general term for greater/less than operators in Python?


I've been working on a Python package which includes functionality for creating queries, which is implemented by overloading the Python operators ==, !=, >=, <=, >, < on certain classes in the package (the syntax of it all is very similar to filtering/indexing on a Pandas DataFrame).

In the process of writing the documentation I found myself looking for a general term for the Python <= and >= operators - here's a snippet from the sentence:

... using the Python inequality operators <= and >=...

I later used the term 'strict inequality operators' to refer to > and <.

I realised my mathematics background was showing, as these are the terms that would be used there (specifically to contrast with the mathematical = for the world of equations), but I don't that necessarily carries into the Python world. Particularly since inequality operator be confused with !=.

All six come under the term comparison operators (e.g. the official language reference and this Real Python tutorial), but my question is: Is there a term that covers the four operators <= >= < >? (and specifically not == !=)


I realise I can solve my documentation problem by using the term comparison operators and making it clear which ones I'm referring to within that category by listing them. But I'm still curious about this question.


Solution

  • "Order comparison" is what the docs use. It emphasizes the importance of an order relation rather than mere equality and inequality, and it clearly excludes !=.