Boston Python workshop 2/Friday tutorial: Difference between revisions

Content added Content deleted
Line 218: Line 218:
<code>TypeError: cannot concatenate 'str' and 'int' objects</code>
<code>TypeError: cannot concatenate 'str' and 'int' objects</code>


Python is giving us a 'traceback'. A traceback is details on what was happening when Python encountered an Exception or Error -- something it doesn't know how to handle.
Python is giving us a <b>traceback</b>. A traceback is details on what was happening when Python encountered an Exception or Error -- something it doesn't know how to handle.


There are many kinds of Python errors, with descriptive names to help us humans understand what went wrong. In this case we are getting a 'TypeError': we tried to do some operation on a data type that isn't supported for that data type.
There are many kinds of Python errors, with descriptive names to help us humans understand what went wrong. In this case we are getting a <code>TypeError</code>: we tried to do some operation on a data type that isn't supported for that data type.


Python gives us a helpful error message as part of the TypeError:
Python gives us a helpful error message as part of the TypeError:
Line 240: Line 240:
</pre>
</pre>


produces a TypeError. We are telling Python to concatenate a string and an integer, and that's not something Python understands how to do.
produces a <code>TypeError</code>. We are telling Python to concatenate a string and an integer, and that's not something Python understands how to do.


In the similar expression
In the similar expression