Why do we need ==?

Terry Reedy tjreedy at udel.edu
Mon Dec 9 12:54:08 EST 2002


"M" <marvelan at hotmail.com> wrote in message
news:c0abefc3.0212090428.202ae1a2 at posting.google.com...
> Just doing some thinking....
>
> Why do Python use the == syntax for comparison?
>
> As assignment inside an if is not possible would not
> comparison could be done with just one =?

Another answer: when using the interpreter interactively,
a=1 # which always executes, and
a==1 # which prints 0, 1, or exception message
are both both possible and sensible.

Terry J. Reedy






More information about the Python-list mailing list