title: How to copy class attributes without instantiation
body: <p>I am trying to copy class attributes from one class to another</p>
  
  <pre><code>d = {1:'one', 2:'two'}
  class X(object):
      a = 1
      b = 2
  </code></pre>
  
  <p>I need to define class Y such that the following is true:
  <code>assert Y.a =='one' and Y.b=='two'</code></p>
  
  <p>One way to achieve this is as follows:</p>
  
  <pre><code>attrDict = {attr:d[getattr(X,attr)] for attr in dir(X) if isinstance(getattr(X,attr), int)}
  # attrDict is {'a':'one', 'b':'two'}
  
  class Y(X):
      def __init__(self):
          self.copyOver()
  
      @classmethod
      def copyOver(klass):
          [setattr(klass, k,v) for k,v in attrDict.iteritems()]
  
  y = Y()  # Y.a = 1 unless this runs
  assert Y.a == 'one' and Y.b == 'two'
  </code></pre>
  
  <p>However, instantiation can be expensive in a real application: Would it be possible to achieve this without?</p>
  
  <p>In other words, <strong><em>what built-in do I use to update class attributes without requiring instantiation of an object of it</em></strong>?</p>
  
  <pre><code>class Y(X):
      #TODO: setattr all key value pairs in attrDict on the class Y, not on instances of it.
      #TODO: Do it without requiring to instantiate an object of class Y
  </code></pre>