[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 7a9d46295a)

Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
This commit is contained in:
Miss Islington (bot) 2025-05-17 15:17:23 +02:00 committed by GitHub
parent b43e1d0b48
commit cca18fcbe8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View 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: