我有一个一流的发言权QClass和实例Q的QClass。
我an_attribute在运行时以某种方式在QClass. 我如何删除它an_attribute使用del Q.an_attribute?
我知道从类中删除该属性将使其无法从其所有实例中访问。
更新:Q暴露给用户,他们只能使用del Q.an_attribute. 我只能更改Q或 的代码QClass。
del在 python 中比delattr. 见/sf/answers/78474791/
所以,跟着
del type(Q).an_attribute
Run Code Online (Sandbox Code Playgroud)