https://github.com/python/cpython/commit/021ee7fd6a09971fbef5cf0e194b8087ae88677d
commit: 021ee7fd6a09971fbef5cf0e194b8087ae88677d
branch: main
author: Peter Sutton <[email protected]>
committer: rhettinger <[email protected]>
date: 2026-04-01T11:16:36-05:00
summary:
Docs: Use !r in __repr__ example (gh-146273)
files:
M Doc/library/functions.rst
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 483e5b1d8fdba7..e8c4605d0578e2 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1754,7 +1754,7 @@ are always available. They are listed here in
alphabetical order.
self.age = age
def __repr__(self):
- return f"Person('{self.name}', {self.age})"
+ return f"Person({self.name!r}, {self.age!r})"
.. function:: reversed(object, /)
_______________________________________________
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]