擅长:python、mysql、java
<p>它实际上什么都不做,唯一能做任何事情的方法,特别是@Daniel在评论中说的,就是如果<code>self.current</code>指的是<a href="https://docs.python.org/2/library/functions.html#property" rel="nofollow">property method</a>。如下所示:</p>
<pre><code>class X():
@property
def current(self):
mail_admins()
return whatever
def next(self):
...
</code></pre>
<p>这样,调用<code>self.current</code>,实际上会做一些事情。你知道吗</p>
<p>但无论如何,这绝对不是好的做法,因为一个属性只是,一个属性,如果它应该做些什么,它应该是方法。你知道吗</p>