In article <mailman.1272.1382221693.18130.python-l...@python.org>, Chris Angelico <ros...@gmail.com> wrote: >On Sun, Oct 20, 2013 at 3:22 AM, rusi <rustompm...@gmail.com> wrote: >> The problem is that python is an imperative language and uses the '=' sign >> for assignment. In math of course >'=' stands for equality. > >Pascal tried to create a new operator, := to be read "becomes", to >deal with the whole equality-vs-assignment issue. Did it really help >anything? I don't think so. Just syntactic salt. Even the comparison >isn't really mathematical - in maths, "x = y" is a statement of truth, >whereas in programming, it's a question ("is x equal to y").
This suggests that Pascal went against established practice. This is false. FORTRAN used = and that was a mistake caused by the language being hacked together haphazardly. Langages that where designed (ALGOL60 SIMULA ALGOL68 Pascal ADA) all use :=. C C++ Java C# use = for assignment because of the inertia caused by FORTRAN. Pascal was created in a culture where it using = would be unexpected. Knuth uses k<-n exactly because k=n would cause confusion. The equivalent of the dreaded if ( x=getch()) { } is possible in ALGOL68 too. It is not likely to be misunderstood because of the use of :=. By the way, it is about the only thing that I think is wrong in Python. > > >ChrisA Groetjes Albert -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst -- https://mail.python.org/mailman/listinfo/python-list