< — Strict less-than
Tests strict ordering. Built-in strings compare lexicographically by code point, and comparable lists and tuples compare at their first differing element. For sets this means proper subset, not a size comparison or total order. Complex numbers and dictionaries do not support ordinary order comparisons. Rich comparisons share precedence and support chaining: the middle operand is evaluated once, and later operands are skipped when a preceding comparison is falsy. If both operands decline the comparison, ordering raises TypeError. Custom dispatch uses __lt__ and the counterpart __gt__ on the other operand; a right-hand subclass may have priority.
Formal Syntax & Structure
left < rightParameters & Attributes
| Name | Type | Description |
|---|---|---|
| left | object | First operand; its type participates in operation selection. |
| right | object | Second operand; supported values depend on the operand types. |
Return Value
Boolean for ordinary built-in comparisons; custom rich comparison methods can return other values.
Working Example
print(3 < 5)print([1,9] < [2,0])print({1} < {1,2})