What is the difference between the two classes below? Do you have some related information about this case? Thank you very much.
class test(object):
def __init__(self, name):
print name
class test():
def __init__(self, name):
print name
In python 2.x, the class that inherits from
objectwill be a new-style class, while the other won’t, while in python 3.x there’ll be both new-style.However, the differences between new and old are rather advanced, (for example, attribute search order) so a beginner shouldn’t be too concerned about the incompatibilities.
See this answer for more information if you’re interested, but it’s rather a thing for library developers etc.