title: What's the Pythonic way to initialize attributes or properties?
body: <p>Python supports class attributes, instance attributes and properties.</p>
  
  <pre><code>from time import ctime, sleep
  
  class MyClass(object):
      A = ctime()            # class attribute
      def __init__(self):
          self.B = ctime()   # instance attribute
          self._C = None
  
      @property
      def C(self):           # property
          if self._C is None:
              self._C = ctime()
          return self._C
      @C.setter
      def C(self, c):
          self._C
  </code></pre>
  
  <p>To a user who is not aware, how MyClass is implemented, A, B, and C show similar behaviour:</p>
  
  <pre><code>sleep(2)
  myObject = MyClass()
  sleep(2)
  print myObject.A         # prints time module was initialized
  print myObject.B         # prints time instance was created, 2 sec later
  print myObject.C         # prints time this line was called, 2 sec later
  myObject.A = 'foo'       # myObject.A is now an instance attribute
  myObject.B = 'foo'       # myObject.B is still an instance attribute
  myObject.C = 'foo'       # myObject.C is still an (instance) property
  print myObject.A         # prints 'foo'
  print myObject.B         # prints 'foo'
  print myObject.C         # prints 'foo'
  </code></pre>
  
  <p>From the answer I got here, I understood the following: The first time <code>myObject.A</code> is printed, <code>myObject.A</code> is <code>myObject.__Class__.A</code> is <code>MyClass.A</code>. The second time <code>myObject.A</code> is not <code>myObject.__Class__.A</code>. Fine.</p>
  
  <p>In the example above, <code>ctime()</code> was used only to illustrate, how A, B and C differ. Now assume, we are using an immutable constant instead:</p>
  
  <pre><code>class MyClass(object):
      A = 'bar'               # class attribute
      def __init__(self):
          self.B = 'meta'     # instance attribute
          self._C = None
  
      @property
      def C(self):            # property
          if self._C is None:
              self._C = 'foobar'
          return self._C
      @C.setter
      def C(self, c):
          self._C = c
  
  myObject = MyClass()
  </code></pre>
  
  <p><code>myObject.A</code> is still the class attribute <code>MyClass.A</code>, while <code>myObject.B</code> is an instance attribute and <code>myObject.C</code> is a property. All of them, do exactly what I want. They have a default value and I can assign some other value. Which <em>style</em> should I use, A, B or C?</p>