if <assignment>:

Dave Brueck dave at pythonapocrypha.com
Wed Nov 27 10:53:37 EST 2002


On Wed, 27 Nov 2002 maney at pobox.com wrote:

> Dave Brueck <dave at pythonapocrypha.com> wrote:
> > proof that the language is broken in that area. We don't say, "Is Tuesday 
> > today?" or "Is 5 your age?", either. :)
> 
> Is it Tuesday today?

Definitely not equivalent (hint: the 'today' in your version is optional).

> The other one is not the most common form, but I don't have any trouble
> at all imagining using it

Perhaps, but that's not the point - an aspect of a language that the
programmer has to think twice about, or be especially careful about, or is
encouraged to think about in an unnatural way ought to have significant
benefit to make it worthwhile. IMO the desire for if-assignment in C is 
driven in part by a desire to fit more on the screen; Python code is more 
vertically compact so I don't miss that feature as much.

In this specific case it's not too big of a deal anymore because most
compilers now will warn you - it's a band-aid instead of a solution, but
it works - but the principle is worth understanding as it helps identify
warts in C, Python, etc.

-Dave





More information about the Python-list mailing list