title: python __str__ in inherited class
body: <p>The following code to set up <code>__str__</code> function with an inherited class fails unless there is a "line" between self and the first attribute, i.e. if the line junk = 99, is commented out the program bombs</p>
  
  <pre><code>class TemplateBlock(object) :
  
      def __init__(self,                            
                   tidno      = 1):                
          self.tidno          = tidno              
  
      def __str__(self) :
          return '%.2d:' % (self.tidno)
  
  class Block(TemplateBlock) :
  
      def __init__(self,                            
                   junk       = 99,                 
                   bidno      = 3) :
          TemplateBlock.__init__(self)                               
          #self.junk           = junk          
          self.bidno          = bidno
  
      def __str__(self) :
          return TemplateBlock.__str__(self) + '\n%.2d' %(self.bidno)
  
      def set(self,t) :                            
          self.tidno          = t.tidno            
  
  tb = TemplateBlock(tidno=2)
  b = Block(tb)
  b.set(tb)
  print(b)
  </code></pre>
  
  <p>Thanking you in advance for your help.</p>