summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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>'