Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
8a01b71f
Commit
8a01b71f
authored
Oct 12, 2014
by
Berker Peksag
Browse files
Options
Browse Files
Download
Plain Diff
Issue #22613: Fix reprlib.Repr subclass example on Python 3.
Reported by Jacques Ducasse.
parents
870903e9
edd6ec2d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
Doc/library/reprlib.rst
Doc/library/reprlib.rst
+4
-4
No files found.
Doc/library/reprlib.rst
View file @
8a01b71f
...
@@ -148,11 +148,11 @@ for file objects could be added::
...
@@ -148,11 +148,11 @@ for file objects could be added::
import sys
import sys
class MyRepr(reprlib.Repr):
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
return obj.name
else:
return repr(obj)
return repr(obj)
aRepr = MyRepr()
aRepr = MyRepr()
print(aRepr.repr(sys.stdin)) # prints '<stdin>'
print(aRepr.repr(sys.stdin)) # prints '<stdin>'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment