[Tutor] What is a semantic error?

Hugo Arts hugo.yoshi at gmail.com
Sun Jan 23 13:41:55 CET 2011


On Sun, Jan 23, 2011 at 1:09 PM, Richard D. Moores <rdmoores at gmail.com> wrote:
>
> Is a semantic error one that Python doesn't see as an error -- no
> error is raised; whereas syntax errors aren't errors unless Python
> sees them as "Syntax Error"s?
>

Pretty much this. A semantic error is also called a logic error. A
program with a semantic error will not crash or terminate abnormally,
but it will not produce the output that you want.

Semantic errors are much harder to catch than syntax errors, because
programs with semantic errors are still valid programs in the
language. A syntax error makes the program invalid, which means the
computer can easily identify it. It's up to you to identify semantic
errors.

HTH,
Hugo


More information about the Tutor mailing list