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):
|
def repr(self, x):
|
||||||
return self.repr1(x, self.maxlevel)
|
return self.repr1(x, self.maxlevel)
|
||||||
def repr1(self, x, level):
|
def repr1(self, x, level):
|
||||||
typename = `type(x)`[7:-2] # "<type '......'>"
|
typename = type(x).__name__
|
||||||
if ' ' in typename:
|
if ' ' in typename:
|
||||||
parts = typename.split()
|
parts = typename.split()
|
||||||
typename = '_'.join(parts)
|
typename = '_'.join(parts)
|
||||||
|
|
Loading…
Reference in New Issue