[Tutor] python errors
alan.gauld at btinternet.com
Mon Apr 14 22:55:32 CEST 2014
From: keith papa <keithadu at live.com>
>To: Alan Gauld <alan.gauld at btinternet.com>
>Sent: Monday, 14 April 2014, 18:19
>Subject: RE: [Tutor] python errors
>>>> x = "foo" - 4
>Traceback (most recent call last):
> File "<pyshell#0>", line 1, in <module>
> x = "foo" - 4
>TypeError: unsupported operand type(s) for -: 'str' and 'int'
>That's right, its a semantic error. You shouldn't be trying to subtract a number
from a string. It's not a meaningful thing to do,
The Python errors are not categorised into syntactic, semantic and runtime
error types, (although there is a syntax error exception). Those are computer
science concepts not explicitly exposed by Python. Python just reports an
error as above.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor