Is this a legal / acceptable statement ?
Philippe Martin
pmartin at snakecard.com
Fri May 5 10:19:08 EDT 2006
I'm sorry (typo):
l_init = False
if True == l_init and 1234 == l_value:
print 'l_value is initialized'
Note that 1234 == l_value does not get evaluated.
Philippe
vbgunz wrote:
> you don't have to say:
>
> if True == l_init
>
> it is suggested you simply say:
>
> if l_init:
>
> Remember the and operator requires expressions on both sides to be true
> to continue. If you notice, your expression on the right side of the
> 'and' is an assignment and so this is forbidden (SyntaxError).
> assignments only work on lines by themselves and no where else.
>
> if you meant == rather than = remember this, l_value doesn't exist and
> would pull up a NameError *but* because the first expression evaluates
> as false the second expression is never evaluated.
>
> refactor your code ASAP. good luck!
More information about the Python-list
mailing list