> 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.
Posted Feb 11, 2008 6:52 UTC (Mon) by jmtapio (guest, #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.