Why would it be necessary to subclass from object in Python?
Posted
by rmh
on Stack Overflow
See other posts from Stack Overflow
or by rmh
Published on 2010-04-26T16:43:11Z
Indexed on
2010/04/26
19:03 UTC
Read the original article
Hit count: 223
python
I've been using Python for quite a while now, and I'm still unsure as to why you would subclass from object
. What is the difference between this:
class MyClass():
pass
And this:
class MyClass(object):
pass
As far as I understand, object
is the base class for all classes and the subclassing is implied. Do you get anything from explicitly subclassing from it? What is the most "Pythonic" thing to do?
© Stack Overflow or respective owner