OT Signature quote [was Re: Unrecognized escape sequences in string literals]

Douglas Alan darkwater42 at gmail.com
Sun Aug 16 04:41:41 EDT 2009


On Aug 16, 4:22 am, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:

> I don't like normal assignment. After nearly four decades of mathematics
> and programming, I'm used to it, but I don't think it is especially good.
> It confuses beginners to programming: they get one set of behaviour
> drilled into them in maths class, and then in programming class we use
> the same notation for something which is almost, but not quite, the same.
> Consider the difference between:
>
> y = 3 + x
> x = z
>
> as a pair of mathematics expressions versus as a pair of assignments.
> What conclusion can you draw about y and z?

Yeah, the syntax most commonly used for assignment today sucks. In the
past, it was common to see languages with syntaxes like

   y <- y + 1

or

   y := y + 1

or

   let y = y + 1

But these languages have mostly fallen out of favor. The popular
statistical programming language R still uses the

   y <- y + 1

syntax, though.

Personally, my favorite is Lisp, which looks like

   (set! y (+ y 1))

or

   (let ((x 3)
         (y 4))
     (foo x y))

I like to be able to read everything from left to right, and Lisp does
that more than any other programming language.

I would definitely not like a language that obscures assignment by
moving it over to the right side of lines.

|>ouglas




More information about the Python-list mailing list