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
e7563632
Commit
e7563632
authored
Jun 07, 2003
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch #750542: Use issubclass instead of type identity.
parent
a2185911
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
Lib/pprint.py
Lib/pprint.py
+8
-8
No files found.
Lib/pprint.py
View file @
e7563632
...
...
@@ -130,7 +130,7 @@ class PrettyPrinter:
write
=
stream
.
write
if
sepLines
:
if
typ
is
dict
:
if
issubclass
(
typ
,
dict
)
:
write
(
'{'
)
if
self
.
_indent_per_level
>
1
:
write
((
self
.
_indent_per_level
-
1
)
*
' '
)
...
...
@@ -157,8 +157,8 @@ class PrettyPrinter:
write
(
'}'
)
return
if
typ
is
list
or
typ
is
tuple
:
if
typ
is
list
:
if
issubclass
(
typ
,
list
)
or
issubclass
(
typ
,
tuple
)
:
if
issubclass
(
typ
,
list
)
:
write
(
'['
)
endchar
=
']'
else
:
...
...
@@ -179,7 +179,7 @@ class PrettyPrinter:
allowance
+
1
,
context
,
level
)
indent
=
indent
-
self
.
_indent_per_level
del
context
[
objid
]
if
typ
is
tuple
and
length
==
1
:
if
issubclass
(
typ
,
tuple
)
and
length
==
1
:
write
(
','
)
write
(
endchar
)
return
...
...
@@ -207,7 +207,7 @@ class PrettyPrinter:
def
_safe_repr
(
object
,
context
,
maxlevels
,
level
):
typ
=
_type
(
object
)
if
typ
is
str
:
if
issubclass
(
typ
,
basestring
)
:
if
'locale'
not
in
_sys
.
modules
:
return
`object`
,
True
,
False
if
"'"
in
object
and
'"'
not
in
object
:
...
...
@@ -226,7 +226,7 @@ def _safe_repr(object, context, maxlevels, level):
write
(
qget
(
char
,
`char`
[
1
:
-
1
]))
return
(
"%s%s%s"
%
(
closure
,
sio
.
getvalue
(),
closure
)),
True
,
False
if
typ
is
dict
:
if
issubclass
(
typ
,
dict
)
:
if
not
object
:
return
"{}"
,
True
,
False
objid
=
_id
(
object
)
...
...
@@ -251,8 +251,8 @@ def _safe_repr(object, context, maxlevels, level):
del
context
[
objid
]
return
"{%s}"
%
_commajoin
(
components
),
readable
,
recursive
if
typ
is
list
or
typ
is
tuple
:
if
typ
is
list
:
if
issubclass
(
typ
,
list
)
or
issubclass
(
typ
,
tuple
)
:
if
issubclass
(
typ
,
list
)
:
if
not
object
:
return
"[]"
,
True
,
False
format
=
"[%s]"
...
...
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