inline assignments in conditionals

Alex Martelli aleax at aleax.it
Mon Apr 29 03:37:51 EDT 2002


Delaney, Timothy wrote:
        ...
>> >    "If Sunday is today, I'm going to go shopping"
>> 
>> I don't think that anybody has had any trouble understanding me when I
>> say 'If today is Saturday, then we are going to the concert house,
> 
> Not at all - this is exactly how I say things.
> 
>> otherwise we are going to hack.'  But then I have been writing
>> if 0 == x for a long time as well.
> 
> The one doesn't follow the other. "If today is Sunday" corresponds to "if
> x is 0" - "today" is the variable, "Sunday" is a constant.

Take another typical English usage then.  "If Bush is the President of the
US ...".  Which one is the "variable" now, and which one the "constant"?
Clearly, who is President varies over time, just as what is 'today', while
'Bush' in this context refers to a specific individual (it may be ambiguous
which one, of course:-).

The distinction in connotation is not variable vs constant -- it is about
what term is supposed to be in doubt:

    "If Bush is the President of the US ... " (rather than being, e.g.,
        the President of General Motors) 

    "if the President of the US is Bush ... " (rather than being, e.g.,
        Gore)

Actually my feeling is that the first form would be quite acceptable
in the second connotation as well, while the latter form would be
totally unacceptable in the former connotation (i.e., the latter form
unambiguously indicates we're musing about different individuals
covering the "President of the US" role; the former form might
indicate that, too, although it's quite OK to indicate the different
case of musing about different roles for one given individual).  But
I doubt i can "prove" it.  Natural language just doesn't fit well into
hard-and-fast formulas, despite the unending efforts of grammarians,
pundits, and purists -- it IS, after all, part of the biology and
sociology of human beings, notoriously funny and fuzzy subjects.
(Which explains why it's so unappropriate as a basis for designing
programming languages, but that's an issue deserving longer discourse).


Yours for descriptive-rather-than-prescriptive linguistics,

Alex




More information about the Python-list mailing list