title: TypeError: unsupported operand type(s) for +: object and str, python
body: <p>I have this code:</p>
  
  <pre><code>from datetime import datetime
  today = datetime.now().strftime('%y-%m-%d')
  
  class PrintMessage():
  
      def __init__(self,msg):
          self.msg = msg
          self.print_message()
  
          util = Utilities() #Class adds date to self.msg
          util.msg_with_time()
  
      def print_message(self): #print default msg
          print(self.msg)
  
  class Utilities():
      def msg_with_time(msg):
         print(msg + ' on ' + today)
  
  if __name__ == '__main__':
  
      inst = PrintMessage("My message") 
  </code></pre>
  
  <p>And it gives me the following error:    </p>
  
  <pre><code> print(msg + ' on ' + today)
   TypeError: unsupported operand type(s) for +: 'Utilities' and 'str
  </code></pre>
  
  <p>I tried using int(today) in case it was that type of a mismatch, but still get the error. When i remove <em>"+ ' on ' + today"</em>, the msg prints, but without the date of course. Also, in the tutorial I'm following, it seems this exact code works. The tutorial uses python 3.1 while i'm using python 3.6, if it matters. </p>
  
  <p>Edit: The default string prints, but the error gets thrown. Am using Eclipse workspace, btw. </p>
  
  <p>I finally figured it out. The issue was, as i sortof had a hunch of, that i forgot to pass 'msg' to util.msg_with_time(), i.e so it becomes util.msg_with_time(msg).</p>