title: Why can't I directly add attributes to any python object?
body: <p>I have this code:</p>
  
  <pre><code>&gt;&gt;&gt; class G:
  ...   def __init__(self):
  ...     self.x = 20
  ...
  &gt;&gt;&gt; gg = G()
  &gt;&gt;&gt; gg.x
  20
  &gt;&gt;&gt; gg.y = 2000
  </code></pre>
  
  <p>And this code:</p>
  
  <pre><code>&gt;&gt;&gt; from datetime import datetime
  &gt;&gt;&gt; my_obj = datetime.now()
  &gt;&gt;&gt; my_obj.interesting = 1
  *** AttributeError: 'datetime.datetime' object has no attribute 'interesting'
  </code></pre>
  
  <p>From my Python knowledge, I would say that <code>datetime</code> overrides <code>setattr</code>/<code>getattr</code>, but I am not sure. Could you shed some light here?</p>
  
  <p>EDIT: I'm not specifically interested in <code>datetime</code>. I was wondering about objects in general.</p>