inline assignments in conditionals

jaf jaf at lcsaudio.com
Sat Apr 27 17:04:30 EDT 2002


Aggh!  Of course I meant it the other way around.  :^P
It would have been a nice example too, if I hadn't completely
stuffed it up.  So for the record, "If today is Sunday" is my
preferred form (i.e. if day == 0), and I should never again
be allowed to post without proofreading first.

Jeremy

>   I think this example is backwards. Today is the variable.  I'd
> usually say: "If today is Sunday, I'm going to go shopping". So much
> for that :)
>
>             -- Mike
>
> On Sat, Apr 27 @ 22:37, Laura Creighton wrote:
> > Jeremy:
> > [snip]
> > > Writing things that way is really unnatural, at least for English
> > > speakers.  It makes the intent of the code harder to understand
> > > (at
> > > least for me).  For example, if you were talking to a friend, you
> > > wouldn't say:
> > >
> > >    "If today is Sunday, I'm going to go shopping"
> > >
> > > but rather:
> > >
> > >    "If Sunday is today, I'm going to go shopping"
> >
> > Interesting.  I would never use the second construct, and I use the
> > first one all the time.  I wonder if this is a difference between
> > people whose first language is English, and some for whom it was
> > not.
> > 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,
> > otherwise we are going to hack.'  But then I have been writing
> > if 0 == x for a long time as well.  (It was great -- Borodin
> > Quartet
> > playing Sjostakovitj and Beethoven, by the way.)
> >
> > Laura Creighton







More information about the Python-list mailing list