Re: strange thing about boolean expressions?

Guido.van.Rossum@cwi.nl
Tue, 26 Oct 1993 10:45:38 +0100

> 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'.

Consider it fixed in 1.0. It is a relic from the days when '=' was
also the equality comparison operator. It also catches typos like

x == 0 # intended: x = 0

which can be relly annoying to find, but I don't think the advantage
of catching those is worth the lack of orthogonality and surprise at
not being able to write "x = v or 'foo'".

--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>