<p>我有一个类<code>sysprops</code>,我想在其中有一些常量。但是,我想从数据库中提取这些常量的值,因此我希望在任何时候访问这些类常量时使用某种钩子(类似于实例变量的<strong>getattribute</strong>方法)。在</p>
<pre><code>class sysprops(object):
SOME_CONSTANT = 'SOME_VALUE'
sysprops.SOME_CONSTANT # this statement would not return 'SOME_VALUE' but instead a dynamic value pulled from the database.
</code></pre>