class Foo(object):
The site you end up with. Everywhere, everywhere, lightly
python
class Foo(object):
pass
Even though it says, it doesn't explain what that ʻobject is ... Even if you google with ʻobject
, it will be converted to an object and searched.
I had a good experience of getting stuck in Doronuma if I didn't get the right search terms [^ 1].
[^ 1]: After I got the search term, I was able to confirm the mention on various sites, so ...
class object
Returns a new object with no user-defined attributes or methods. object () is the base class of the new style class. It has a set of methods common to instances of the new style class.
First, you need to know that Python 2.2 really has two classes: classic or old style classes, and new style classes. The model of the old style class is exactly the same as the class model of the previous version. All new features described in this section apply only to new style classes. We don't want this deviation to last forever; eventually the old style class will be abolished. Maybe in Python 3.0.
――Even though it is a "new style class", it is quite old [^ 2] because it is a new style in the era of Python 2.2. --Don't use the old style class.
[^ 2]: In 2001.
Recommended Posts