]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-138011: Clarify tutorial method object example code (GH-138014) (#138026)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 21 Aug 2025 16:40:15 +0000 (18:40 +0200)
committerGitHub <noreply@github.com>
Thu, 21 Aug 2025 16:40:15 +0000 (12:40 -0400)
x must be a MyClass instance for examples to work.

---------

(cherry picked from commit 339f5da6395868073e22157424405b89cafb5c6d)

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

index 492568961d8a513d25b03b0312606e825b3ba370..c4480e90b7243c4c67ce415bbe3f16edcaae928a 100644 (file)
@@ -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::