class A:
def __init__(self):
print('this is __init__ function')
def __str__(self):
print('this is __str__ function')
"""类、函数、方法、描述器或生成器实例的名称"""
print(A.__name__) # A
"""类实例所属的类"""
print(A().__class__) # <class '__main__.A'>
"""由类对象的基类所组成的元组"""
print(A.__bases__) # (<class 'object'>,)
"""一个字典或其他类型的映射对象,用于存储对象的(可写)属性"""
print(A.__dict__)
# {'__module__': '__main__', '__init__': <function A.__init__ at 0x7f95b020db00>,
# '__str__': <function A.__str__ at 0x7f95a0035170>, '__dict__': <attribute '__dict__' of 'A' objects>,
# '__weakref__': <attribute '__weakref__' of 'A' objects>, '__doc__': None}