From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Sat, 17 May 2025 13:17:23 +0000 (+0200) Subject: [3.14] gh-88275: Add missing `__init__` method to `match` example (GH-120281) (#134142) X-Git-Tag: v3.14.0b2~129 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cca18fcbe817a24bfeeb7f15a00158f8214e010d;p=thirdparty%2FPython%2Fcpython.git [3.14] gh-88275: Add missing `__init__` method to `match` example (GH-120281) (#134142) gh-88275: Add missing `__init__` method to `match` example (GH-120281) (cherry picked from commit 7a9d46295a497669eaa6e647c33ab71c8cf620a1) Co-authored-by: Kirill Podoprigora --- diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst index 3c815721a92f..f8df802768a9 100644 --- a/Doc/whatsnew/3.10.rst +++ b/Doc/whatsnew/3.10.rst @@ -551,11 +551,12 @@ 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: - x: int - y: int + def __init__(self, x, y): + self.x = x + self.y = y def location(point): match point: