]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-88275: Add missing `__init__` method to `match` example (#120281)
authorKirill Podoprigora <kirill.bast9@mail.ru>
Sat, 17 May 2025 13:11:19 +0000 (14:11 +0100)
committerGitHub <noreply@github.com>
Sat, 17 May 2025 13:11:19 +0000 (15:11 +0200)
Doc/whatsnew/3.10.rst

index f5e38950756afecbfc2856d64627468df75d9bde..1067601c652300cabccb5bed8dde17f1b0290ee6 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: