[Tutor] python: how do I create a list of definitions?

Kent Johnson kent37 at tds.net
Fri Jul 20 04:20:17 CEST 2007

Luke Paireepinart wrote:
>> if  x = 2243:
> this will always evaluate to true.

No, it is a syntax error.

> x is being assigned the value of 2243.  2243 is being returned by the 
> assignment.

No, assignment is a statement, not an expression; that's why it is a 
syntax error.

> You can observe this in the following situation:
>  >>> y = x = 2243
>  >>> y
> 2243

I think this is a special case of assignment. Try
y = (x = 2243)
and you will see that (x = 2243) is not an expression.


More information about the Tutor mailing list