Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7a9d462

Browse files
authored
gh-88275: Add missing__init__ method tomatch example (#120281)
1 parentb41d79c commit7a9d462

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

‎Doc/whatsnew/3.10.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -551,11 +551,12 @@ Patterns and classes
551551
552552
If you are using classes to structure your data, you can useas a pattern
553553
theclass name followed by an argumentlist resembling a constructor. This
554-
pattern has the ability to captureclass attributes into variables::
554+
pattern has the ability to captureinstance attributes into variables::
555555
556556
class Point:
557-
x:int
558-
y:int
557+
def__init__(self, x, y):
558+
self.x = x
559+
self.y = y
559560
560561
def location(point):
561562
match point:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp