title: Call attribute method python
body: <p>I want to display hour when i call <code>date.now.hour</code> but I get this error</p>
  <pre><code>AttributeError: 'function' object has no attribute 'hour'
  </code></pre>
  <p>this is my code:</p>
  <pre><code>#!/usr/bin/python
  
  class Date:
      def now(self):
          self.hour = &quot;hour&quot;
          print &quot;Now&quot;
      
      def __call__(self, string):
          print string    
      
  date = Date()
  date('hello') # print hello
  date.now.hour # print hour
  </code></pre>
  <p>My task is</p>
  <blockquote>
  <p>Make a class that can do this:</p>
  <p><code>date.now()</code> - output: <code>'now'</code></p>
  <p><code>date('hai')</code> - output: <code>'hai'</code></p>
  <p><code>date.now</code> output: <code>'now'</code></p>
  <p><code>date.now.hour</code> output: <code>'hour'</code></p>
  </blockquote>