| name | python-typing-discipline |
| description | Type-hint rules for echo-sdk — no Any unless boundary, Protocol for structural typing, narrow Unions, PEP 604 syntax. Use when writing public API signatures. |
Typing Discipline
Python 3.11+. Use modern syntax and narrow types.
Rules
Common mistakes
def foo(x) -> Any → name the type; if you don't know, refactor.
- Using
typing.List in new code → list[T].
- Stringified types everywhere → only needed for forward refs / circular imports.
Union[X, None] → X | None.
See also
[[python-pydantic-v2]], [[generic-no-premature-abstraction]]