Why do we need ==?

M marvelan at hotmail.com
Mon Dec 9 07:28:03 EST 2002


Just doing some thinking....

Why do Python use the == syntax for comparison?

As assignment inside an if is not possible would not
comparison could be done with just one =?

Why can't we do:

if a = 1:
    print "Foo"

instead of

if a == 1:
   print "Bar"

???
I think a 

if a equal 1:
   print "Foo"

is better instead of == (which does not carry any clue as to what they
do) if one single = is not possible...

ok, I'm not saying we should change Python right now. Just curious...



More information about the Python-list mailing list