mirror of
https://github.com/python/cpython.git
synced 2024-11-28 04:15:11 +08:00
Use type(x).__name__ to get the name of the type instead of parsing
repr(type(x)).
This commit is contained in:
parent
0263c80b90
commit
a995c91243
@ -14,7 +14,7 @@ class Repr:
|
||||
def repr(self, x):
|
||||
return self.repr1(x, self.maxlevel)
|
||||
def repr1(self, x, level):
|
||||
typename = `type(x)`[7:-2] # "<type '......'>"
|
||||
typename = type(x).__name__
|
||||
if ' ' in typename:
|
||||
parts = typename.split()
|
||||
typename = '_'.join(parts)
|
||||
|
Loading…
Reference in New Issue
Block a user