diff --git a/peps/pep-0727.rst b/peps/pep-0727.rst index b090874c6..b30b34608 100644 --- a/peps/pep-0727.rst +++ b/peps/pep-0727.rst @@ -163,8 +163,8 @@ For example: from typing import Annotated, Doc class User: - first_name: Annotated[str, Doc("The user's first name")] - last_name: Annotated[str, Doc("The user's last name")] + name: Annotated[str, Doc("The user's name")] + age: Annotated[int, Doc("The user's age")] ... @@ -264,8 +264,8 @@ Class attributes may be documented: from typing import Annotated, Doc class User: - first_name: Annotated[str, Doc("The user's first name")] - last_name: Annotated[str, Doc("The user's last name")] + name: Annotated[str, Doc("The user's name")] + age: Annotated[int, Doc("The user's age")] ... @@ -276,8 +276,8 @@ As can function or method parameters and return values: from typing import Annotated, Doc def create_user( - first_name: Annotated[str, Doc("The user's first name")], - last_name: Annotated[str, Doc("The user's last name")], + name: Annotated[str, Doc("The user's name")], + age: Annotated[int, Doc("The user's age")], cursor: DatabaseConnection | None = None, ) -> Annotated[User, Doc("The created user after saving in the database")]: """Create a new user in the system. @@ -305,8 +305,8 @@ For example: from typing_extensions import Doc class User: - first_name: Annotated[str, Doc("The user's first name")] - last_name: Annotated[str, Doc("The user's last name")] + name: Annotated[str, Doc("The user's name")] + age: Annotated[int, Doc("The user's age")] ... @@ -563,10 +563,10 @@ of a symbol and providing runtime access to those values: .. code:: python class User: - first_name: str - "The user's first name" - last_name: str - "The user's last name" + name: str + "The user's name" + age: int + "The user's age" ... @@ -588,8 +588,8 @@ In the discussion, it was also suggested to use a plain string inside of from typing import Annotated class User: - first_name: Annotated[str, "The user's first name"] - last_name: Annotated[str, "The user's last name"] + name: Annotated[str, "The user's name"] + age: Annotated[int, "The user's age"] ... @@ -614,8 +614,8 @@ documentation string: from typing import Doc class User: - first_name: Doc[str, "The user's first name"] - last_name: Doc[str, "The user's last name"] + name: Doc[str, "The user's name"] + age: Doc[int, "The user's age"] ...