擅长:python、mysql、java
<blockquote>
<p>I'm looking for a way to make PyLint accept accessing mangled attributes of a client subclass</p>
</blockquote>
<p>有办法愚弄皮林。在</p>
<p>一种方法是将<code>parent</code>伪装成<code>self</code>:</p>
<pre><code>@property
def __ascendants(self):
for parent in self.__parents:
self = parent
yield from self.__ascendants
yield self
</code></pre>
<p>另一种方法是使用<code>getattr</code>间接访问属性。而不是:</p>
^{pr2}$
<p>执行:</p>
<pre><code>yield from getattr(parent, '__ascendants')
</code></pre>