From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 17 Jul 2023 08:15:52 +0000 (-0700) Subject: [3.11] gh-106780: Add __match_args__ to tutorial example (GH-106784) (#106820) X-Git-Tag: v3.11.5~194 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6193f783d02190a66f287b3a36c187a9323dcc2b;p=thirdparty%2FPython%2Fcpython.git [3.11] gh-106780: Add __match_args__ to tutorial example (GH-106784) (#106820) Add Point definition with this attribute before example that needs it. (cherry picked from commit 7aa89e505d893cd5e6f33b84d66e5fa769089931) Co-authored-by: Terry Jan Reedy --- diff --git a/Doc/tutorial/controlflow.rst b/Doc/tutorial/controlflow.rst index 4336bf50df40..e140f51f1dda 100644 --- a/Doc/tutorial/controlflow.rst +++ b/Doc/tutorial/controlflow.rst @@ -343,7 +343,13 @@ Dotted names (like ``foo.bar``), attribute names (the ``x=`` and ``y=`` above) o (recognized by the "(...)" next to them like ``Point`` above) are never assigned to. Patterns can be arbitrarily nested. For example, if we have a short -list of points, we could match it like this:: +list of Points, with ``__match_args__`` added, we could match it like this:: + + class Point: + __match_args__ = ('x', 'y') + def __init__(self, x, y): + self.x = x + self.y = y match points: case []: