[Python-ideas] Combining test and assignment
jeanpierreda at gmail.com
Mon Jan 23 00:15:49 CET 2012
On Sun, Jan 22, 2012 at 5:58 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> So I stand by my claim: there is no natural English analog of an
> explicit assignment in the middle of the clause.
There isn't a natural English analogue of explicit assignment at all.
English doesn't have variables or anything like them. It has names,
but these names cannot be redefined -- try telling someone "Bill is my
cat", followed by, "Bill is my dad", and they'll give you a queer
look. And then they'll interpret this as two different Bills, rather
than just one that was "redefined" to mean something else, and if you
refer to Bill again they will ask "which one?"
There are unnatural phrases that work like assignment, and those same
phrases can be used unnaturally to refer to assignment within an "if"
as well. "Let the letter X refer to Y", "now let the letter X refer to
Z", "if foo, which the letter X will now refer to, is a piece of ham,
..." But that's kind of silly.
More generally, I'm not convinced programming has to fit into
"natural" English. It should be expressible, yes, but it doesn't have
to be idiomatic English. "Programming is an unnatural act. " (Perlis)
(Perhaps it must be idiomatic in Dutch?)
More information about the Python-ideas