Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 36d8ef9 commit edd6ec2Copy full SHA for edd6ec2
1 file changed
Doc/library/reprlib.rst
@@ -148,11 +148,11 @@ for file objects could be added::
148
import sys
149
150
class MyRepr(reprlib.Repr):
151
- def repr_file(self, obj, level):
152
- if obj.name in ['<stdin>', '<stdout>', '<stderr>']:
+
+ def repr_TextIOWrapper(self, obj, level):
153
+ if obj.name in {'<stdin>', '<stdout>', '<stderr>'}:
154
return obj.name
- else:
155
- return repr(obj)
+ return repr(obj)
156
157
aRepr = MyRepr()
158
print(aRepr.repr(sys.stdin)) # prints '<stdin>'
0 commit comments