inline assignments in conditionals

Delaney, Timothy tdelaney at avaya.com
Sun Apr 28 21:11:02 EDT 2002


> From: Laura Creighton [mailto:lac at strakt.com]
> > 
> >    "If today is Sunday, I'm going to go shopping"
> > 
> > but rather:
> > 
> >    "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.

Tim Delaney





More information about the Python-list mailing list