summaryrefslogtreecommitdiffstats
path: root/Doc/library/reprlib.rst
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2014-10-12 02:11:16 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2014-10-12 02:11:16 (GMT)
commitedd6ec2dd38d0251adecfafb3cfe821afd14dd34 (patch)
tree869cd867449b746f6f8e13a45d90941041e5ccc9 /Doc/library/reprlib.rst
parent36d8ef9cc7441790f8840f82454bbc9b214354b2 (diff)
downloadcpython-edd6ec2dd38d0251adecfafb3cfe821afd14dd34.zip
cpython-edd6ec2dd38d0251adecfafb3cfe821afd14dd34.tar.gz
cpython-edd6ec2dd38d0251adecfafb3cfe821afd14dd34.tar.bz2
Issue #22613: Fix reprlib.Repr subclass example on Python 3.
Reported by Jacques Ducasse.
Diffstat (limited to 'Doc/library/reprlib.rst')
-rw-r--r--Doc/library/reprlib.rst8
1 files changed, 4 insertions, 4 deletions
diff --git a/Doc/library/reprlib.rst b/Doc/library/reprlib.rst
index ee68263..1c694f9 100644
--- a/Doc/library/reprlib.rst
+++ b/Doc/library/reprlib.rst
@@ -148,11 +148,11 @@ for file objects could be added::
import sys
class MyRepr(reprlib.Repr):
- def repr_file(self, obj, level):
- if obj.name in ['<stdin>', '<stdout>', '<stderr>']:
+
+ def repr_TextIOWrapper(self, obj, level):
+ if obj.name in {'<stdin>', '<stdout>', '<stderr>'}:
return obj.name
- else:
- return repr(obj)
+ return repr(obj)
aRepr = MyRepr()
print(aRepr.repr(sys.stdin)) # prints '<stdin>'