summaryrefslogtreecommitdiffstats
path: root/Doc/whatsnew
diff options
context:
space:
mode:
authorShantanu <12621235+hauntsaninja@users.noreply.github.com>2022-05-20 14:32:29 (GMT)
committerGitHub <noreply@github.com>2022-05-20 14:32:29 (GMT)
commitf20a6a54fb041507a334ad71706974960d1b473f (patch)
tree37622fd972648b742e97697738478d9ed21bd00f /Doc/whatsnew
parentd8537580921b2e02f477ff1a8dedcf82c24ef0c2 (diff)
downloadcpython-f20a6a54fb041507a334ad71706974960d1b473f.zip
cpython-f20a6a54fb041507a334ad71706974960d1b473f.tar.gz
cpython-f20a6a54fb041507a334ad71706974960d1b473f.tar.bz2
gh-91860: documentation for typing.dataclass_transform (#92768)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r--Doc/whatsnew/3.11.rst10
1 files changed, 5 insertions, 5 deletions
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst
index 1f88d25..ff94e45 100644
--- a/Doc/whatsnew/3.11.rst
+++ b/Doc/whatsnew/3.11.rst
@@ -306,17 +306,17 @@ Kumar Srinivasan and Graham Bleaney.)
PEP 681: Data Class Transforms
------------------------------
-The new :data:`~typing.dataclass_transform` annotation may be used to
-decorate a function that is itself a decorator, a class, or a metaclass.
+:data:`~typing.dataclass_transform` may be used to
+decorate a class, metaclass, or a function that is itself a decorator.
The presence of ``@dataclass_transform()`` tells a static type checker that the
-decorated function, class, or metaclass performs runtime "magic" that
-transforms a class, endowing it with dataclass-like behaviors.
+decorated object performs runtime "magic" that
+transforms a class, giving it :func:`dataclasses.dataclass`-like behaviors.
For example::
# The ``create_model`` decorator is defined by a library.
@typing.dataclass_transform()
- def create_model(cls: Type[_T]) -> Type[_T]:
+ def create_model(cls: Type[T]) -> Type[T]:
cls.__init__ = ...
cls.__eq__ = ...
cls.__ne__ = ...