Operator Functions
operator.le()
Apply the rich comparison <= to two operands, respecting Python comparison dispatch. Ordinary numeric operands return bool, but a custom comparison hook may return another object. This is a callable alternative to the expression, useful as a predicate when its result is truth-testable.
Formal Syntax & Structure
python syntaxpython
operator.le(a, b, /)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| a | object | Left operand or target object. |
| b | object | Right operand. |
Return Value
object
The object result described above.
Working Example
Example Snippetpython
import operatorprint(operator.le(5, 5))