$10K coding deathmatch
Michael L Torrie
torriem at chem.byu.edu
Mon Nov 6 15:04:01 MST 2006
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?
More information about the PLUG