From: Terry Jan Reedy Date: Thu, 21 Aug 2025 15:02:29 +0000 (-0400) Subject: gh-138011: Clarify tutorial method object example code (#138014) X-Git-Tag: v3.15.0a1~626 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=339f5da6395868073e22157424405b89cafb5c6d;p=thirdparty%2FPython%2Fcpython.git gh-138011: Clarify tutorial method object example code (#138014) x must be a MyClass instance for examples to work. --------- Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> --- diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst index fa964271d79b..9ab003d5cd3d 100644 --- a/Doc/tutorial/classes.rst +++ b/Doc/tutorial/classes.rst @@ -359,7 +359,7 @@ Usually, a method is called right after it is bound:: x.f() -In the :class:`!MyClass` example, this will return the string ``'hello world'``. +If ``x = MyClass()``, as above, this will return the string ``'hello world'``. However, it is not necessary to call a method right away: ``x.f`` is a method object, and can be stored away and called at a later time. For example::