From 097e8f33e1e8440cf474c2f299fd900b02f886f7 Mon Sep 17 00:00:00 2001 From: Kirill Podoprigora Date: Sat, 8 Jun 2024 19:43:48 +0000 Subject: [PATCH 1/2] Add __init__ to the example --- Doc/whatsnew/3.10.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst index b939ccd17903f2..98c308fd56260a 100644 --- a/Doc/whatsnew/3.10.rst +++ b/Doc/whatsnew/3.10.rst @@ -554,8 +554,9 @@ the class name followed by an argument list resembling a constructor. This pattern has the ability to capture class attributes into variables:: class Point: - x: int - y: int + def __init__(self, x, y): + self.x = x + self.y = y def location(point): match point: From 17ec708f9d182a530f614e56702d49af4ee76916 Mon Sep 17 00:00:00 2001 From: Kirill Podoprigora Date: Sat, 8 Jun 2024 20:14:49 +0000 Subject: [PATCH 2/2] class attributes -> instance attributes --- Doc/whatsnew/3.10.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst index 98c308fd56260a..bc732ab16f89a2 100644 --- a/Doc/whatsnew/3.10.rst +++ b/Doc/whatsnew/3.10.rst @@ -551,7 +551,7 @@ Patterns and classes If you are using classes to structure your data, you can use as a pattern the class name followed by an argument list resembling a constructor. This -pattern has the ability to capture class attributes into variables:: +pattern has the ability to capture instance attributes into variables:: class Point: def __init__(self, x, y):