[Tutor] How to get all methods of "object"?

DL Neil PyTutor at danceswithmice.info
Sat Sep 21 20:12:21 EDT 2019


On 22/09/19 11:29 AM, boB Stepp wrote:
> Python 3.7.4
> I tried to do this with:
>>>> for attribute in dir(object):
>      print(attribute)
...

> But I know at least one that is not listed:  __dict__  And I would not
> be surprised if there are others.
> Basically, I am wondering what are *all* the things inherited from
> "object" when one creates one's own class?
> I am currently trying to find such a list in the Python 3 docs, but so
> far I have been unsuccessful.

An interesting idea...

Try creating a class (which inherits the basic "object"), then __dict__ 
(and two other 'extra' attributes) will become visible/pertinent.

By definition, doesn't "inheritance" mean that the sub-class includes 
*all* of the attributes (data and code) of its super-class(es)?

(I'm not mentioning "slots" in a bid to preserve @boB's sanity)
-- 
Regards =dn


More information about the Tutor mailing list