How do I reference existing class variables when defining them
<p>I would like doing:</p>

<pre><code>class Whatevs(object):
    foo = 3
    bar = foo * 3

    def __init__(self):
        # enhance!
</code></pre>

<p>or How acan I make it possible to work correctly. ;)</p>

<p><strong>EDIT:</strong></p>

<p>Ok, it turns out that that is not the problem, the above works fine, <em>this</em> though:</p>

<pre><code>class Whatevs(object):
    foo = 3
    zap = list(foo for _ in range(10))
</code></pre>

<p>Oh you, Python! I can come up with some workarounds, but can someone explain to me what is going on precisely? Why can't the generator access the class variables?</p>
