Why '==' ??
Erik Max Francis
max at alcyone.com
Tue Mar 30 16:34:35 EST 2004
Vrai Stacey wrote:
> JCM wrote:
>
> > a = b = c
> > a = b == c
>
> I had no idea you could do that! I was under the impression that
> assignment didn't return a value in Python, hence it being impossible
> to
> use one as a conditional.
Assignment can't, and that isn't one, but the assignment statement is
defined such that you can change assignments together with no problems.
So in
a = b = c
c is the expression evaluated, which is assigned to both a and b,
whereas in
a = b == c
b == c is the exression assigned to a.
--
__ Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
/ \ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
\__/ But you're not going to be there tomorrow. And it's all about
tomorrow. -- Montgomery Brogan
More information about the Python-list
mailing list