From 7fba02d76c2d16da7b8c26d2c7d0d05a6b53cb9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Thu, 12 Oct 2023 16:16:44 +0200 Subject: [PATCH] PEP 727: Update `first_name` to `name` from feedback by Gregory P. Smith (#3478) --- peps/pep-0727.rst | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) 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"] ...