Why '==' ??
Tim Peters
tim.one at comcast.net
Tue Mar 30 11:05:53 EST 2004
[John Roth]
> I believe the earliest versions of Python did use the single equal
> sign for comparisons. I don't know why Guido changed it, but
> it might be in order to keep his options open.
It was to stop ambiguity. This was especially acute at an interactive
shell, where guessing what
>>> x = y
intended often guessed wrong <wink> (it's common to wonder whether two
things are equal at a shell prompt). After the change, that became obvious:
>>> x = y # assignment
>>> x == y # equal?
False
>>>
More information about the Python-list
mailing list