Reputation: 1978
I would like to know the what are the methods and properties in the object
class of Python but I can't find the documentation anywhere. Do you guys know where can I find it?
Upvotes: 1
Views: 101
Reputation: 363384
You can use dir
to list them:
>>> dir(object)
['__class__',
'__delattr__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__le__',
'__lt__',
'__ne__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__']
Be warned that an object can lie about what attributes are there. For example, object.mro
exists but the dir chooses not to tell you about it.
To find an "uncensored" list, try this:
>>> object.__dir__(object)
Upvotes: 3