Re: EXACT meaning of 2 error messages

new topic     » goto parent     » topic index » view thread      » older message » newer message

A comparison of error messages for a minimal one line program:

Program Language Message
typo Euphoria

<0076>:: expected to see an assignment after 'typo',
such as =, +=, -=, *=, /= or &=
<end-of-file>
^
<eucode>
Python

Traceback (most recent call last):
File "e1.py", line 2, in <module>
typo
NameError: name 'typo' is not defined 
typo = Euphoria

<0135>:: Syntax error - expected to see an expression,
not the end of file
<end-of-file>
^
Python

File "e2.py", line 2
typo  =
^
SyntaxError: invalid syntax
typo = 3 Euphoria

<0074>:: Errors resolving the following references:
'typo' (e3.ex:2) has not been declared.
typo = 3
^
Python valid syntax for Python

You can frustate yourself using any progamming language. However, you may get less frustration using Euphoria.

  • If you write typo (as a one line program)
    • Euphoria assumption is that you wanted to write "typo" and tells you what should come next.
    • Python assumption is that you have already made a mistake. (A helpful message here.)
  • If you write typo =
    • Euphoria tells you that an expression must come next.
    • Python tells you that you made a mistake. ("SyntaxError" is a very common message; Python tends not to be helpful.)
  • If you write typo = 3
    • Euphoria reminds you that "typo" has not been declared.
    • Python says this is a valid program. (But surprise if you did not intend for "typo" to be a variable name.)

Python was designed to teach programming; I would have expected better error messages from Python.

_tom

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu