8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
__init__
match
1 parent b41d79c commit 7a9d462Copy full SHA for 7a9d462
Doc/whatsnew/3.10.rst
@@ -551,11 +551,12 @@ Patterns and classes
551
552
If you are using classes to structure your data, you can use as a pattern
553
the class name followed by an argument list resembling a constructor. This
554
-pattern has the ability to capture class attributes into variables::
+pattern has the ability to capture instance attributes into variables::
555
556
class Point:
557
- x: int
558
- y: int
+ def __init__(self, x, y):
+ self.x = x
559
+ self.y = y
560
561
def location(point):
562
match point:
0 commit comments