Change repr() of a new-style class to say <class 'ClassName'> rather

than <type 'ClassName'>.  Exception: if it's a built-in type or an
extension type, continue to call it <type 'ClassName>.  Call me a
wimp, but I don't want to break more user code than necessary.
This commit is contained in:
Guido van Rossum 2001-09-25 03:56:29 +00:00
parent 5c294fb0e6
commit a4cb78874c
3 changed files with 15 additions and 8 deletions

View file

@ -208,7 +208,7 @@ class foo(object):
''')
from areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation import foo
eq(repr(foo.foo),
"<type 'areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation.foo.foo'>")
"<class 'areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation.foo.foo'>")
def test_object(self):
# XXX Test the repr of a type with a really long tp_name but with no