= vs. == in Py3k
Steven D. Arnold
stevena at permanent.cc
Fri Jun 9 10:20:17 EDT 2000
At 11:18 PM 6/8/2000 -0700, Lawrence Kesteloot wrote:
>But this isn't worth the trouble it gives new programmers. The
>syntax could be changed to make = and == equivalent tokens
>and have the parser figure out which is meant from the context,
>just as it's done in Basic. The documentation would only ever
>mention =, but the language would support == for backward
>compatibility.
Or we could have `==' always be a comparison operator, but if `=' was used
in `==' context, it would be interpreted as `=='. One possible negative is
that this could lead to inconsistent coding and sloppiness, but it seems
like a virtue of a good scripting language to be as understanding as
possible about this sort of error. (I do think at a minimum a user should
at least be able to set a flag to get compiler warnings, a la perl `-w',
and when this flag is set, an `=' in an if clause should raise a warning.)
steve
More information about the Python-list
mailing list