https://github.com/python/cpython/commit/339f5da6395868073e22157424405b89cafb5c6d commit: 339f5da6395868073e22157424405b89cafb5c6d branch: main author: Terry Jan Reedy <[email protected]> committer: terryjreedy <[email protected]> date: 2025-08-21T11:02:29-04:00 summary:
gh-138011: Clarify tutorial method object example code (#138014) x must be a MyClass instance for examples to work. --------- Co-authored-by: Stan Ulbrych <[email protected]> files: M Doc/tutorial/classes.rst diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst index fa964271d79bd8..9ab003d5cd3dd5 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:: _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
