擅长:python、mysql、java
<p>对于以后的阅读,我只想提供一个稍微改进一下已经提出的答案。。。在</p>
<p><strong>自定义持久集类</strong></p>
<pre><code>class PersistentSet(Persistent):
def __init__(self, *args, **kwargs):
self._set = set(*args, **kwargs)
def __getattr__(self, name):
return getattr(self._set, name)
</code></pre>
<p><strong>库中的持久集类</strong></p>
^{pr2}$
<hr/>
<p><em>另见</em></p>
<ul>
<li><a href="https://stackoverflow.com/questions/36901/what-does-double-star-and-star-do-for-python-parameters">What does ** (double star) and * (star) do for parameters?</a></li>
<li><a href="https://stackoverflow.com/questions/3278077/difference-between-getattr-vs-getattribute">Difference between __getattr__ vs __getattribute__</a></li>
<li><a href="http://docs.zope.org/zope3/Code/BTrees/OOBTree/OOSet.1" rel="nofollow noreferrer">http://docs.zope.org/zope3/Code/BTrees/OOBTree/OOSet.1</a></li>
</ul>