[Python-checkins] gh-106625 : Add missing code to tutorial 4.6 example (#106623)

terryjreedy webhook-mailer at python.org
Tue Jul 11 13:22:11 EDT 2023


https://github.com/python/cpython/commit/d0b7e18262e69dd4b8252e804e4f98fc9533bcd6
commit: d0b7e18262e69dd4b8252e804e4f98fc9533bcd6
branch: main
author: RustyNail <takonoyawarakaage at yahoo.co.jp>
committer: terryjreedy <tjreedy at udel.edu>
date: 2023-07-11T13:22:07-04:00
summary:

gh-106625 : Add missing code to tutorial 4.6 example (#106623)

* 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 at udel.edu>

files:
M Doc/tutorial/controlflow.rst

diff --git a/Doc/tutorial/controlflow.rst b/Doc/tutorial/controlflow.rst
index c9b3d982c31c9..4336bf50df40a 100644
--- a/Doc/tutorial/controlflow.rst
+++ b/Doc/tutorial/controlflow.rst
@@ -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:



More information about the Python-checkins mailing list