]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-88275: Add missing `__init__` method to `match` example (GH-120281) (#134143)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 17 May 2025 13:18:14 +0000 (15:18 +0200)
committerGitHub <noreply@github.com>
Sat, 17 May 2025 13:18:14 +0000 (13:18 +0000)
gh-88275: Add missing `__init__` method to `match` example (GH-120281)
(cherry picked from commit 7a9d46295a497669eaa6e647c33ab71c8cf620a1)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Doc/whatsnew/3.10.rst

index e4699fbf8edaf7ee72265561f83977e1452c7519..d2eecf34f8cf40b7c4e4b781b7d21e51dc54b10e 100644 (file)
@@ -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: