在基类和派生的python类中定义相同的槽

2024-04-26 11:44:32 发布

您现在位置:Python中文网/ 问答频道 /正文

这个docs说:

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.

如何引入未定义的行为?举个例子吧?实例看起来如何-它是否同时具有这两个属性?你知道吗


Tags: theinstanceindocsbasebyifis