$10K coding deathmatch

Andrew McNabb amcnabb at mcnabbs.org
Mon Nov 6 14:05:16 MST 2006


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')

but that's still way uglier than using if/else statements.  What's so
great about cramming everything on one line?

-- 
Andrew McNabb
http://www.mcnabbs.org/andrew/
PGP Fingerprint: 8A17 B57C 6879 1863 DE55  8012 AB4D 6098 8826 6868



More information about the PLUG mailing list