title: List comprehensions in class initializers in Python
body: <p>On my version of Python (version info below), the following breaks at the line that assigns the variable e (but works just fine up until that point):</p>
  
  <pre><code>class Foo:
    a = 1
    b = a + 2
    print(b) # works
    c = [ "apple", "banana", "cherry", "dragonfruit" ]
    d = [ "I like " + fruit for fruit in c]
    print(d) # works
    d2 = c + ["elderberry"]
    print(d2) # works
    e = ["I like " + c[i] for i in range(4)] #ERROR: NameError: name 'c' is not defined
    print(e)
  </code></pre>
  
  <p>This surprises me; I can't tell whether this is intended behavior or a bug in Python. If this is intentional, can someone explain the intent?</p>
  
  <p>From what I've seen, the problem only occurs in the context of static class variables. In other words, of course, if I replace "class Foo" with "if True" then the whole thing works without an error.</p>
  
  <p>I'm using the following version of Python on OS-X 10.9.5:
  Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 23 2015, 02:52:03)</p>