Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
212 views
in Technique[技术] by (71.8m points)

Is it necessary or useful to inherit from Python's object in Python 3.x?

In older Python versions when you create a class, it can inherit from object which is as far I understand a special built-in Python element that allows your class to be a new-style class.

What about newer versions (> 3.0 and 2.6)? I googled about the object class but I get so many results (for obvious reasons).

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You don't need to inherit from object to have new style in python 3. All classes are new-style.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...