= vs. == in Py3k

John McKown newsuser at linux2.johnmckown.net
Fri Jun 9 06:35:13 EDT 2000


On Thu, 8 Jun 2000 23:18:26 -0700, Lawrence Kesteloot <lk at veriomail.com> wrote:
>
>If one of the goals of Python 3000 is to make it easy for new
>programmers to learn, how about removing the distinction
>between = and ==?  The only kinds of examples I can think of
>where this is useful is something like:
	[snip]

I totally disagree. I, personally, dislike having a single token mean more
than one thing. The concepts between assignment (=) and equality (==) are
totally different. The use of = and == might be confusing for a newbie.
But somebody who really wants to learn will learn. I know that I have problems
because I use multiple languages, and sometimes I try to put Perl expressions
in Python programs (doesn't work <grin>). In your example of A=B=5, you'd
have to figure out which of the two incompatable meanings is to be the correct
one. Is it A is assigned the value of true or false based on B being equal
to 5 or is it A is assigned the value of B which is assigned the value of 5 
(meaning A & B are both assigned the value of 5). Some would want it one
way, and some the other. If = is assignment and == is equality, then there
is no confusion. And I have different languages which intepret it differently,
so I make mistakes when I move between them. That's why many of my programs
don't do that sort of think. I use simplier, unambiguous statements and hope
that the compiler / interpreter is "smart".

Anyway, just my thoughts, remember how much they cost you.
John



More information about the Python-list mailing list