Why '==' ??

Fuzzyman michael at foord.net
Wed Mar 31 09:19:14 CEST 2004


"Tim Peters" <tim.one at comcast.net> wrote in message news:<mailman.124.1080662765.20120.python-list at python.org>...
> [John Roth]
> > I believe the earliest versions of Python did use the single equal
> > sign for comparisons. I don't know why Guido changed it, but
> > it might be in order to keep his options open.
> 
> It was to stop ambiguity.  This was especially acute at an interactive
> shell, where guessing what
> 
> >>> x = y
> 
> intended often guessed wrong <wink> (it's common to wonder whether two
> things are equal at a shell prompt).  After the change, that became obvious:
> 
> >>> x = y  # assignment
> >>> x == y # equal?
>  False
> >>>


Despite *all* that...

The lines

if a = 3 
   print 'Yeah baby'

are still *unambiguous*.... yet the interpreter refuses to understand
you......

Theres no reason why a single '=' shouldn't be understood in a
conditional....
As for needing a ':' to allow statements after a 'def' or a
conditional.... python already has the ';' for that... why insist on a
':'

Regards,


Fuzzy

http://www.voidspace.org.uk/atlantibots/pythonutils.html



More information about the Python-list mailing list