 <p>Concatenation doesn't cause <code>self.b</code> to be evaluated as a string. You need to explicitly tell Python to coerce it into a string.</p> <p>You could do:</p> <pre><code>return "&lt;A with " + repr(self.b) + " inside&gt;" </code></pre> <p>But using <code>str.format</code> would be better.</p> <pre><code>return "&lt;A with {} inside&gt;".format(self.b) </code></pre> <p>However as jonrsharpe points out that would try to call <code>__str__</code> first (if it exists), in order to make it specifically use <code>__repr__</code> there's this syntax: <code>{!r}</code>.</p> <pre><code>return "&lt;A with {!r} inside&gt;".format(self.b) </code></pre>