Use type(x).__name__ to get the name of the type instead of parsing

repr(type(x)).
This commit is contained in:
Guido van Rossum 2001-08-09 18:56:27 +00:00
parent 0263c80b90
commit a995c91243

View File

@ -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)