title: Why is my object render function displaying None?
body: <p>So I'm currently building a Html rendering program in Python which uses two base classes:</p>
  <ol>
  <li>SingleTag - Used for tags that don't have any children such as a <p> tag</li>
  <li>ContainingTag - For tags that have nested tags such as the Html tag, Div tag etc...</li>
  </ol>
  <p>Here is the file which contains those classes, along with the subclasses that inherit from them:</p>
  <pre><code>class ContainingTag:
      def __init__(self, children):
          self.open_tag = &quot;&lt;&quot; + self.__class__.__name__.lower() + &quot;&gt;&quot;
          self.close_tag = &quot;&lt;/&quot;+self.__class__.__name__.lower() + &quot;&gt;&quot;
          self.children = children
  
      def render(self):
          print(&quot;\t&quot; + self.open_tag)
          for child in self.children:
              print(&quot;\t \t&quot; + str(child.render()))
          print(&quot;\t&quot; + self.close_tag)
  </code></pre>
  <pre><code>class SingleTag:
      &quot;&quot;&quot;A class to represent an html tag&quot;&quot;&quot;
  
      # Class initialiser
      def __init__(self, inner_html):
          self.open_tag = &quot;&lt;&quot; + self.__class__.__name__.lower() + &quot;&gt;&quot;
          self.close_tag = &quot;&lt;/&quot;+self.__class__.__name__.lower() + &quot;&gt;&quot;
          self.inner_html = inner_html
  
      # Prints html
      def render(self):
          return self.open_tag + self.inner_html + self.close_tag
  </code></pre>
  <pre><code>class Html(ContainingTag):
      def __init__(self, children):
          super().__init__(children) 
          self.open_tag = &quot;&lt;!DOCTYPE html&gt;\n&quot;+ &quot;&lt;&quot; + self.__class__.__name__.lower() + &quot;&gt;&quot;
      
      def render(self):
          print(self.open_tag)
  
          for child in self.children:
              print(&quot;\t \t&quot; + str(child.render()))
          print(self.close_tag)
  
  
  class Head(ContainingTag):
      def __init__(self, children):
          super().__init__(children)
  
  class Style(ContainingTag):
      def __init__(self, children):
          super().__init__(children)
  
  class Body(ContainingTag):
      def __init__(self, children):
          super().__init__(children)  
  
  class Div(ContainingTag):
      def __init__(self, children):
          super().__init__(children)
  
  class P(SingleTag):
      def __init__(self, inner_html=None):
          super().__init__(inner_html=None)
          self.inner_html = inner_html
  </code></pre>
  <p>When using the render method on a SingleTag object, it renders as expected, but when using the render method on a ContainingTag, it prints 'None' after every closing tag like this:</p>
  <pre><code>&lt;Opening ContainingTag&gt;
  &lt;Closing ContainingTag&gt;
  None
  </code></pre>
  <p>Can someone explain why this keeps printing and how to fix this? Thanks.</p>