[Tutor] python errors
ALAN GAULD
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.
Alan g.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140414/5b6498f5/attachment-0001.html>
More information about the Tutor
mailing list