>=
"At least" — ordering with the boundary included. Superset testing for sets.
Common call
if age >= 18:
Returns
bool
Replaces
on sets, >= means "is superset of"
Watch out
the >= vs > choice IS the boundary decision — make it consciously
aa — Left operand.type: comparable · required >= bb — Right operand.type: comparable · required
→ bool
Demo
Live evaluation
Try:
Inputs
afloatleft
bfloatright
Output
21 >= 18
True
True at and above the boundary — the age-check shape. Equality passing is the entire difference from >.
Operands
| Name | Type | Required | Description |
|---|---|---|---|
| a | comparable | yes | Left operand. |
| b | comparable | yes | Right operand. |
Return value
bool — True when a orders after b or equals it.
Common patterns
Minimum requirements
Versions, ages, quotas.
if python_version >= (3, 9): use_removeprefix()
Superset testing
On sets, >= is the superset relation.
provided >= required # everything needed is there
Examples
1. Greater
21 >= 18
Returns
True2. Boundary passes
18 >= 18
Returns
True3. Tuple versions
(3, 12) >= (3, 9)
Returns
TruePitfalls
1. Version STRINGS compare wrong
Lexicographic "3.10" is less than "3.9" — compare tuples instead.
Wrong
"3.10" >= "3.9"
False
Fix
(3, 10) >= (3, 9)
True
When to use
Use it
- Inclusive minimums ("at least")
- Version gates via tuples
- Superset tests on sets
Reach for something else
- Strict bound wanted → >
- Version strings → parse to tuples first
Notes
Complexity
O(1) numbers; O(n) sequences/sets
Return
bool
CPython impl
Objects/object.c :: PyObject_RichCompare (Py_GE) → __ge__
Memory
No allocation
Thread-safe
Yes for immutable operands
FAQ
Tuples compare element-by-element numerically — (3, 10) > (3, 9). Strings compare character-by-character, so "3.10" < "3.9" because "1" < "9".
History
1.0
Core operator from the beginning.