擅长:python、mysql、java
<p>为了完整起见,这里是<code>class</code>解决方案:</p>
<pre><code>class Download(object):
def __init__(self):
self.executed = False
def __call__(self):
print('http' if self.executed else 'tftp')
self.executed = True
download = Download()
download() # tftp
download() # http
download() # http
</code></pre>
<p>这允许您以非黑客方式跨调用存储状态。在</p>