Imagine saying these operators out loud.
is “is greater than”
So it makes sense to use =
as “is greater than or equal to”
You’d think =
would be “is equal to”, but it’s already used for “set equal to” (i.e., assignment).
So what symbol do we use for “is equal to”? The symbol used in many programming languages is ==
, so Python chose to follow that convention.
It’s worth noting that there are other languages that use =
as “is equal to”, and use something else for assignment (like :=
for example). It just comes down to the history of the language and what conventions the original authors decided to use.
I’ve written code before in some hardware-specific languages before (I think it was for programming a stepper motor or something?) that used
=
for both assignment and comparison. If I recall correctly, the language was vaguely C-like, but assignment was not permitted in the context of a comparison. So something likeif( a = (b+c) )
would not assign a value toa
, it would just do the comparison.