]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-106625 : Add missing code to tutorial 4.6 example (#106623)
authorRustyNail <takonoyawarakaage@yahoo.co.jp>
Tue, 11 Jul 2023 17:22:07 +0000 (02:22 +0900)
committerGitHub <noreply@github.com>
Tue, 11 Jul 2023 17:22:07 +0000 (13:22 -0400)
* Added missing import statement.

* Update Doc/tutorial/controlflow.rst

* Update Doc/tutorial/controlflow.rst

* Update controlflow.rst

* Make point regular class with __init__.

---------

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Doc/tutorial/controlflow.rst

index c9b3d982c31c9af8ec01a2eb36f1b394e4b9df4a..4336bf50df40a73871217f3cb2d6c7409fc2d0cc 100644 (file)
@@ -307,8 +307,9 @@ you can use the class name followed by an argument list resembling a
 constructor, but with the ability to capture attributes into variables::
 
     class Point:
-        x: int
-        y: int
+        def __init__(self, x, y):
+            self.x = x
+            self.y = y
 
     def where_is(point):
         match point: