Python: "TypeError: __str__ returned non-string" but still prints to output?
<p>I have this piece of code which creates a new note..WHen I try to print I get the following error even though it prints the output</p>

<pre><code>Error:
C:\Python27\Basics\OOP\formytesting&gt;python notebook.py
Memo=This is my first memo, Tag=example
Traceback (most recent call last):
  File "notebook.py", line 14, in &lt;module&gt;
    print(firstnote)
TypeError: __str__ returned non-string (type NoneType)
</code></pre>

<p>note.py</p>

<pre><code>import datetime
class Note:
    def __init__(self, memo, tags):
        self.memo = memo
        self.tags = tags
        self.creation_date = datetime.date.today()

    def __str__(self):
        print('Memo={0}, Tag={1}').format(self.memo, self.tags)


if __name__ == "__main__":
    firstnote = Note('This is my first memo','example')
    print(firstnote)
</code></pre>
