On Mon, 2006-11-06 at 16:05 -0500, Andrew McNabb wrote:
> On Mon, Nov 06, 2006 at 01:00:40PM -0800, Hill, Greg wrote:
> > > Let me be radical and propose:
> > >
> > > if value:
> > > print 'match'
> > > else:
> > > print 'not a match'
> >
> > print ($value) ? 'match' : 'not a match';
> >
> > Yay for tertiary operators. Of course, Python may or may not have
> > those, I wouldn't know. I'm a Perl bigot.
> >
>
> Recent perl will let you do:
>
> print ('match' if value else 'not a match')
It may be ugly to you, but it is fairly logical from an english grammar
point of view, although it would be more logical to have this construct:
print 'match' if value otherwise print 'sdfsdf'
That's more in line with a logical english sentence. I think I'd prefer
C's syntax for this kind of thing to this new python syntax.
>
> but that's still way uglier than using if/else statements. What's so
> great about cramming everything on one line?
>
/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/