Why '==' ??
Andrew Koenig
ark at acm.org
Tue Mar 30 13:17:01 EST 2004
"Fuzzyman" <michael at foord.net> wrote in message
news:8089854e.0403300510.1971c24 at posting.google.com...
> I may be about to get flamed as some heretic against the ancient
> way..... but if assignment in conditional statements isn't
> possible.... why do we need to use '==' instead of just '=' for if and
> while statements ?
One reason is that you can assign multiple variables at the same time:
a = b = c = 0
Would you prefer the first = to be assignment and the others to be
comparison?
(it's certainly possible -- PL/I does it that way -- but would you prefer
it?)
More information about the Python-list
mailing list