What in the world is the attribute “__class__” in python

后端 未结 4 1072
太阳男子
太阳男子 2020-12-05 07:00

I have a question about __class__ in python.

The documentation says that __class__ is the class to which a class instance belongs. So I con

4条回答
  •  旧时难觅i
    2020-12-05 07:08

    Rebinding (i.e. assigning) an attribute on an object with the same name as an attribute on the class shadows the attribute on the class. The object is always checked for attributes first, followed by the classes in MRO order.

提交回复
热议问题