[Edu-sig] Equality and Assignment Notation

Josh McKenzie josh_mckenzie@hotmail.com
Sun, 07 Apr 2002 17:04:19 +0000


Hi

Why does Python use the equal sign (=) to mean assignment, and use
two equal signs (==) to mean equality? Equality and assignment are
not the same, yet the meaning of the equal sign is universally
understood, so why redefine its meaning?

I know other languages like Java and C++ employ this convention too,
but how does one explain the logic behind this approach?

I'll readily admit to a bias: when I see the notation ':=' in
languages like Pascal, Smalltalk or Eiffel etc, I can at least
understand the distinction these languages attempt to impart to the
user that equality and assignment are similar, but distinct concepts.

It may seem a trivial point to bring up, but while I can explain the
difference between equality and assignment, I cannot explain the
logic of using the '=' and '==' notation.

Thanks :-)

Regards - Josh M.

_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx