Why = = (and not just =)

Terry Reedy tjreedy at udel.edu
Sun Oct 19 18:10:39 EDT 2003


"Joe Green" <someone at microsoft.com> wrote in message
news:3f92eb51$0$259$cc9e4d1f at news.dial.pipex.com...
> Sorry, I cant help aking stupid questions:
>
> I understand why we need = = in C, but why in Python (or Java),
> surely if you write
>  if a=b: pass # syntax error
> it could not possibly mean anything other than what I intended
> (which was of course if a = = b:) ?

It could also mean that the writer was trying to do assignment in an
expression, as one can do in C.

TJR






More information about the Python-list mailing list