]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-138011: Clarify tutorial method object example code (#138014)
authorTerry Jan Reedy <tjreedy@udel.edu>
Thu, 21 Aug 2025 15:02:29 +0000 (11:02 -0400)
committerGitHub <noreply@github.com>
Thu, 21 Aug 2025 15:02:29 +0000 (11:02 -0400)
x must be a MyClass instance for examples to work.

---------
Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Doc/tutorial/classes.rst

index fa964271d79bd83dca54012dfb0af75df9dc4a0d..9ab003d5cd3dd5d6ce3d52da230f2d72be1cbb00 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::