Using 'Or'

Bernardo Sulzbach mafagafogigante at gmail.com
Sat Jan 16 18:12:31 EST 2016


On Sat, Jan 16, 2016 at 8:47 PM, Alister <alister.ware at ntlworld.com> wrote:
>>
>> default = "I like Brussels sprouts."
>> message = random.choice(["", "I like boiled cabbage."])
>> print( message or default )
>>
>>
>>
> I hope I never see production code like that
>

I agree. If you are going to use spaces after '(' and before ')' at
least be consistent.

-- 
Bernardo Sulzbach



More information about the Python-list mailing list