TypeError during assignment to attribute reference?
<p>Reading about <a href="https://docs.python.org/3/reference/simple_stmts.html#assignment-statements" rel="nofollow">Assignment statements</a> in the Python's docs I found this:</p>

<blockquote>
  <p>If the target is an attribute reference: The primary expression in the reference is evaluated. It should yield an object with assignable attributes; if this is not the case, <code>TypeError</code> is raised. That object is then asked to assign the assigned object to the given attribute; if it cannot perform the assignment, it raises an exception (usually but not necessarily <code>AttributeError</code>).</p>
</blockquote>

<p>I'm wondering how to get this <code>TypeError</code>?</p>

<p><strong>What Python's types doesn't have routine for setting attributes?</strong></p>

<p>If you want to raise TypeError in your code:</p>

<pre><code>raise TypeError
</code></pre>

<p>I suggest you read up on exceptions and exception handling in Python for more information. <a href="https://docs.python.org/3/tutorial/errors.html" rel="nofollow">https://docs.python.org/3/tutorial/errors.html</a> </p>

python python-3.x typeerror attr