Class_object's name is accessible through .__name__
,
See the codes:
>>> object
<class 'object'>
>>> object.__name__
'object'
Nevertheless, the __name__
method is
not
in
class_object's default setting.
the codes:
>>> foo = dir(object)
>>> foo
['__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__']
>>> foo.count('__name__')
0 # '__name__' is not in list
object is a base for all classes. It has the methods that are common to all instances of Python classes.
Where __name__
's setting is located in?