Re: strange thing about boolean expressions?

Steven D. Majewski (sdm7g@galen.med.virginia.edu)
Mon, 25 Oct 1993 20:44:41 -0400

On Oct 25, 17:35, Bill Janssen wrote:
>
> Why can't I use the following?
>
> v = None
> x = v or 'foo'
>
> I get a syntax error. Aren't boolean expressions valid on the
> right hand side of an assignment? I'd imagine that this evals
> to 'foo'.
>

x = ( v or 'foo' )

will work as expected.
The parends are necessary.
I think this is a relic in the parser of the early days when
boolean equal was "=" rather than "==" .

[ This came up in discussion earlier, but elvis.med.virginia.edu
is again DEAD, and I can't get access to my python-list archive. ]

- Steve Majewski