]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Docs: Use !r in __repr__ example (gh-146273)
authorPeter Sutton <petersutton.2009@gmail.com>
Wed, 1 Apr 2026 16:16:36 +0000 (17:16 +0100)
committerGitHub <noreply@github.com>
Wed, 1 Apr 2026 16:16:36 +0000 (11:16 -0500)
Doc/library/functions.rst

index 483e5b1d8fdba7b92d790ffce855a8bfdf09ddc5..e8c4605d0578e289efc313c2f827fa888ba6e3c4 100644 (file)
@@ -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, /)