Short if

Duncan Booth me at privacy.net
Wed Jul 7 14:04:11 CEST 2004


Thomas Lindgaard <thomas at it-snedkeren.BLACK_HOLE.dk> wrote in 
news:pan.2004.07.07.09.14.45.845781 at it-snedkeren.BLACK_HOLE.dk:

>   bool = false
>   string = 'This is ' + (( bool ) ? 'true' : 'false')

You don't actually need a conditional expression here at all:

aBool = False
string = 'This is ' + str(aBool)

sets string to 'This is False'



More information about the Python-list mailing list