gh-88275: Add missing __init__ method to match example (#120281)

This commit is contained in:
Kirill Podoprigora 2025-05-17 14:11:19 +01:00 committed by GitHub
parent b41d79c776
commit 7a9d46295a
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: