From 530026619149c19b494849948c0d1f45e0585575 Mon Sep 17 00:00:00 2001 From: NginxL <8777777+NginxL@users.noreply.github.com> Date: Mon, 7 Dec 2026 03:31:01 +0800 Subject: [PATCH] docs: explain container type annotations Assisted-by: DSH AI coding agent --- CHANGELOG.md | 1 + docs/pages/container.rst | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f93f8fe9..46a9c38f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ See [0Ver](https://0ver.org/). ### Documentation - Explain how to choose between `bind` and the `bind_*` functions +- Explain variable type annotations in the container basics example ## 0.30.0 diff --git a/docs/pages/container.rst b/docs/pages/container.rst index 0203887a6..0da38f08a 100644 --- a/docs/pages/container.rst +++ b/docs/pages/container.rst @@ -74,6 +74,13 @@ Here's how it looks: style F1 fill:green style F2 fill:green +The assignment below uses Python's variable annotation syntax. +In ``result: Result[int, Any]``, ``Result[int, Any]`` tells a type checker +that the successful value is an ``int`` and the error type is unrestricted. +The annotation is optional: writing ``result = ...`` lets the type checker +infer the type of the assigned value. Annotations do not change the runtime +value or perform a type conversion. + .. code:: python >>> from typing import Any