]> granicus.if.org Git - python/commitdiff
Use type(x).__name__ to get the name of the type instead of parsing
authorGuido van Rossum <guido@python.org>
Thu, 9 Aug 2001 18:56:27 +0000 (18:56 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 9 Aug 2001 18:56:27 +0000 (18:56 +0000)
repr(type(x)).

Lib/repr.py

index f9cfcf647aa76648b1ff6da1ebc2d414d5dba43d..f418d1a5f60d92ca56ad49258c37b99d5e5d87fb 100644 (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)