From 4d0296649a48ff9dbc290394ff656cf3dea86107 Mon Sep 17 00:00:00 2001 From: "Eric V. Smith" Date: Sun, 28 Jan 2018 09:25:45 -0500 Subject: [PATCH] Add example for PEP 557. (GH-5383) --- Doc/whatsnew/3.7.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst index 5e355345e3..9979e69239 100644 --- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -323,6 +323,17 @@ Adds a new module ``dataclasses``. It provides a class decorator ``typing.NamedTuple``, but also works on classes with mutable instances, among other features. +For example:: + + @dataclass + class Point: + x: float + y: float + z: float = 0.0 + + p = Point(1.5, 2.5) + print(p) # produces "Point(x=1.5, y=2.5, z=0.0)" + .. seealso:: :pep:`557` -- Data Classes -- 2.50.1