BartC wrote:
On 26/06/2016 08:36, Lawrence D’Oliveiro wrote:
One of Python’s few mistakes was that it copied the C convention of
using “=” for assignment and “==” for equality comparison.
One of C's many mistakes. Unfortunately C has been very influential.
I'm not sure it's fair to call it a mistake. C was
designed for expert users, and a tradeoff was likely
made based on the observation that assignment is
used much more often than equality testing.
However, why couldn't Python have used "=" both for assignment, and for
equality?
Because an expression on its own is a valid statement,
so
a = b
would be ambiguous as to whether it meant assigning b
to a or evaluating a == b and discarding the result.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list