LWN.net Logo

Python/Ruby

Python/Ruby

Posted Feb 11, 2008 1:23 UTC (Mon) by ikm (subscriber, #493)
In reply to: Python/Ruby by jmtapio
Parent article: Interview: Mark "Markey" Kretschmann (Not the Gentoo Weekly News)

> Python does have a ternary operator.
> >>> 'foo' if True else 'bar'
>'foo'
> >>> 'foo' if False else 'bar'
> 'bar'

Which version of Python is that? The one I have right now as a system default (2.4.4, Debian
sid) barfs at the given syntax.


(Log in to post comments)

Python/Ruby

Posted Feb 11, 2008 6:52 UTC (Mon) by jmtapio (subscriber, #23124) [Link]

That syntax was added in 2.5.0 (released in September 2006). It is in Debian stable (python2.5) but the default version still has not been migrated even in unstable.

Python/Ruby

Posted Feb 11, 2008 11:08 UTC (Mon) by drag (subscriber, #31333) [Link]

Python 2.5 is certainly a good thing. I am Debian user and habitually specify python2.5 when
working on my own stuff.

Hopefully Python 3000 will be even better. 

Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds