Skip to content

gh-88275: Add __init__ method to the example #120281

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Doc/whatsnew/3.10.rst
Original file line number Diff line number Diff line change
@@ -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:
Loading