= vs. == in Py3k
Michael Hudson
mwh21 at cam.ac.uk
Fri Jun 9 10:52:54 EDT 2000
"Steven D. Arnold" <stevena at permanent.cc> writes:
> 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.
One of Python's unqualified Good Things is not trying to infer
programmer intent from half-wrong code.
> (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.)
Rather better to give a SyntaxError *all* the time, no? Then you
learn not to do it pretty quickly. I've never really understood calls
for '-w'-type flags in Python; constructs of dubious character should
be outlawed, not discouraged.
(Actually, I can see some merit in flagging things that are *usually*
wrong, but have some virtue, eg. "do you *really* want to have that
mutable default argument", but that could be a more static thing).
Cheers,
M.
--
41. Some programming languages manage to absorb change, but
withstand progress.
-- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html
More information about the Python-list
mailing list