Short if

Alex Hunsley lard at tardis.ed.ac.molar.uk
Mon Jul 12 12:02:01 CEST 2004


Thomas Lindgaard wrote:
> Hello
> 
> Does Python have a short if like C or PHP:
> 
>   bool = false
>   string = 'This is ' + (( bool ) ? 'true' : 'false')
> 
> ?

No, thankfully! It's ugly and makes for less maintainable code IMO (as it is 
effectively an inside-out if that you have to rewrite if you want to add any 
more conditional code).




More information about the Python-list mailing list