Defining same slot in base and derived python class

佐手、 提交于 2019-12-10 10:51:18

问题


The docs say:

If a class defines a slot also defined in a base class, the instance variable defined by the base class slot is inaccessible (except by retrieving its descriptor directly from the base class). This renders the meaning of the program undefined. In the future, a check may be added to prevent this.

How is the undefined behavior introduced ? What would be an example ? How does the instance look like - does it have both attributes somehow ?

来源:https://stackoverflow.com/questions/41159714/defining-same-slot-in-base-and-derived-python-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!