assignment expression peeve

Paul Rubin http
Fri Oct 17 15:11:24 EDT 2003


Carl Banks <imbosol at aerojockey.invalid> writes:
> No.  Go look up the word understand.  Whether assignment expressions
> are easy to read, or hard to read, I can UNDERSTAND them just fine.

You're not making any sense.  To understand an expression, you have to
read it first.  So if it's hard to read, it's hard to understand.

> Some of us have programmed in C or Lisp for a long time, and don't
> realize how counterintuitive and awkward the construction is.

Then after you've programmed in C or Lisp for a while, maybe the
construction stops being counterintuitive and awkward, hmm?  Sort of
like putting the adjective after the noun instead of before it is
counterintuitive for English speakers, but becomes intuitive if you
speak French for a while?  If Python had those expressions too, they
would also become intuitive and non-awkward for Python programmers.

(Btw, I remember the exact moment when assignment expressions in C
became natural to me: When I first started learning C from Brian
Kernighan's C tutorial that explained 

  while ((c = getchar()) != '\0')
    do stuff with c;

I had to spend a few moments understanding what was happening, but
then it made perfect sense.  No long period of counterintuition or
awkwardness for me, thanks.  So there's another counterexample to your
theory.  In fact I had an "aha" when I saw that "a = b = c;" is also
an assignment expression in C and worked automatically for that
reason.  In Python, of course, it's a special syntactic kludge with,
um, no natural language analog, not that that matters.)

> > Frankly your thing about no natural language analog sounds like hot
> > air to me.
> 
> Go back a few posts, and you'll see I implored you to take my
> linguistic argument as you would.  You evidently felt it was
> reasonable enough to argue with.  If you'd like to dismiss it as
> crap, be my guest.  I'm here to defend my views, not to change your
> mind.

OK then, based on the decades of experience of millions of C and Lisp
programmers, I'll take your advice and dismiss your linguistic view as
crap.  If you want to continue to embrace it, be my guest.  Happy
crapping.




More information about the Python-list mailing list